Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

RE: Customizing Logger file names

Shapira, Yoav

2003-10-17



Howdy,

>Okay, here I am, my first Java lines. I downloaded tomcat 4.1.27
sources
>and perform the following in :
>src/share/org/apache/catalina/logger/FileLogger.java
>
>Added a line
>
>import java.lang.String;
>
>In the import part of the file, Added :
>
>private String localhostname = "";
>
>to define the string near the suffix String declaration.
>
>Then, I fetch the local host name like this :
>
>   public String getLocalHostName() {
>
>     return (localhostname);
>
>   }

Do you set localhostname anywhere? Try this:

private String localHostName = null;
protected String getLocalHostName() {
if(localHostName == null) {
  try {
   InetAddress localHost = InetAddress.getLocalHost();
   localHostName = localHost.getHostName();
  } catch (Exception e) {
   localHostName = "error";
  }

return localHostName;
}

You need to import java.net.InetAddress for the above to compile.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.