Output destinations are handled by Appenders, not Loggers.  In particualr,
file destinations are handled by FileAppender and its subslasses.

Programtically, you can do something like:

Logger logger = ...;
logger.removeAllAppenders();
FileAppender appender = new FileAppender();
appender.setLayout( new SimpleLayout() );
appender.setFile( "/usr/home/peter/logs/myLog.log" );
appender.activateOptions();  // This "initializes the appender, opening the
File, etc
logger.addAppender( appender );





    |-----Original Message-----
    |From: Peter Choe [mailto:[EMAIL PROTECTED]]
    |Sent: Tuesday, September 03, 2002 2:42 PM
    |To: Log4J Users List; Log4J Users List
    |Subject: Re: dynamic log file
    |
    |
    |i was looking for something that can be configured 
    |programmatically.
    |
    |something like:
    |
    |logger.setFile("/usr/home/peter/logs/myLog.log");
    |
    |but there is no setFile(), right?
    |
    |Peter Choe
    |
    |At 02:56 PM 9/3/2002, [EMAIL PROTECTED] wrote:
    |
    |>Pete:
    |>
    |>You can use parameter substituion in the configuration 
    |file to determine
    |>the path of the log file(s).  For example:
    |>
    |># A1 is set to be a RollingFileAppender for debugging noise.
    |>log4j.appender.A1=org.apache.log4j.RollingFileAppender
    |>log4j.appender.A1.File=${user.debugLog}
    |>
    |>
    |>${user.debugLog} substitutes the value the System 
    |Property "user.debugLog"
    |>for the log file name.
    |>
    |>I am new in the mail group.  Hope I have understood and 
    |answered your
    |>question.
    |>
    |>Bill Blalock
    |>
    |>
    |>
    |> 
    |>
    |>                       Peter 
    |> Choe 
    |>
    |>                       <choepete@mindspr        To: 
    |> [EMAIL PROTECTED]
    |>                       ing.com>                 cc: 
    | >
    |>                                                Subject:  
    |dynamic log 
    |> file
    |>                       09/03/2002 
    |> 01:54 
    |>
    |>                       PM 
    | >
    |>                       Please respond 
    |> to 
    |>
    |>                       "Log4J 
    |> Users 
    |>
    |>                       List" 
    | >
    |> 
    |>
    |> 
    |>
    |>
    |>
    |>
    |>
    |>is there a way to tell dynamically where the out put for 
    |the log file can
    |>go?
    |>
    |>i want a servlet to read a file parameter which will tell 
    |the servlet which
    |>
    |>file to use to log output.
    |>
    |>Peter
    |>
    |>
    |>--
    |>To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to