logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Location of log files
Date Tue, 05 Aug 2003 17:56:32 GMT

Have you tried using system properties? Log4j performs variable 
substitution in XML files as well.

At 01:44 PM 8/5/2003 -0400, Grum Ketema wrote:
>I could not find a simple solution
>to this problem. I deploy a web application (a War file) in
>a web server (iplanet) and an ejb application ( an ear file) in
>OAS (oracle application server). I want to use log4j in both applications.
>The logging works fine. The problem is specifying the location of the log
>I use log4j.xml to configure log4j. In there I have to specify the location
>of the
>log file as absolute path. This creates a problem because we have to edit
>during each deployment of our application to edit the location of the log
>I attempted to solve the problem by adding the following code in a utility
>                 rootLogger = Logger.getRootLogger();
>                 FileAppender fp = (FileAppender) 
> rootLogger.getAppender("LOGFILE");
>                 String fileName = fp.getFile();
>                 String dir = getOracleRootDir();
>                 if (dir!=null) {
>                                 StringBuffer logFilePath = new 
> StringBuffer(dir);
>                                 fp.setFile(logFilePath.toString());
>                                 fp.activateOptions();
>                 }
>which is kind of clumsy. Is there any way of specifying the location of the
>file without editing log4j.xml (e.g. programmatically or otherwise)

Ceki For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message