You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Wataru Fukushima <w....@pfu.fujitsu.com> on 2002/11/05 12:59:36 UTC
Way to set another log file for one category with different log level
How can I write log4j.proerties to output two different log files for one
category when each threshold is different?
In other words, I want two output:
- error.log for output errors only
- debug.log for output all logs
The Java code is something like this:
Logger log = Logger.getLogger("log")
log.error("error message");
log.warn("warning message");
And I want those two files will be:
<error.log>
error message
<debug.log>
error message
warning message
I cannot find out any sample log4j.properties in neither short manual nor
FAQ.
Thanks in advance,
-------------------------------
Wataru Fukushima
PFU LIMITED
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Way to set another log file for one category with different log
level
Posted by Wataru Fukushima <w....@pfu.fujitsu.com>.
Thank you for your information, Jake.
On Tue, 05 Nov 2002 06:20:45 -0600, according to the article
"Re: Way to set another log file for one category with different log level"
Jacob Kjome <ho...@visi.com> wrote:
> I guess you could set up two appenders which are referenced in the root
> logger and then have a filter in each appender specifying which log level
> to output.
Actually I did not know that each appender threshold can be set by specifying
log4j.appender.xxxxx.threshold=XXXX
in log4j.properties.
> >How can I write log4j.proerties to output two different log files for one
> >category when each threshold is different?
Finally I made it by setting log4j.properties as follows:
log4j.rootCategory=DEBUG
log4j.category.log=DEBUG, log, errorlog
log4j.appender.log=org.apache.log4j.RollingFileAppender
log4j.appender.log.layout=org.apache.log4j.PatternLayout
log4j.appender.log.layout.ConversionPattern=%d %F %L %-5p %m%n
log4j.appender.log.File=debug.log
log4j.appender.errorlog=org.apache.log4j.RollingFileAppender
log4j.appender.errorlog.threshold=ERROR
log4j.appender.errorlog.layout=org.apache.log4j.PatternLayout
log4j.appender.errorlog.layout.ConversionPattern=%d %F %L %-5p %m%n
log4j.appender.errorlog.File=error.log
I could not use root logger since I've used other appenders to write other
logs to other files.
> >In other words, I want two output:
> > - error.log for output errors only
> > - debug.log for output all logs
> >
> >The Java code is something like this:
> >
> > Logger log = Logger.getLogger("log")
> > log.error("error message");
> > log.warn("warning message");
> >
> >
> >And I want those two files will be:
> >
> ><error.log>
> > error message
> >
> ><debug.log>
> > error message
> > warning message
-------------------------------
Wataru Fukushima
PFU LIMITED
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Way to set another log file for one category with
different log level
Posted by Jacob Kjome <ho...@visi.com>.
I guess you could set up two appenders which are referenced in the root
logger and then have a filter in each appender specifying which log level
to output.
Jake
At 08:59 PM 11/5/2002 +0900, you wrote:
>How can I write log4j.proerties to output two different log files for one
>category when each threshold is different?
>
>In other words, I want two output:
> - error.log for output errors only
> - debug.log for output all logs
>
>The Java code is something like this:
>
> Logger log = Logger.getLogger("log")
> log.error("error message");
> log.warn("warning message");
>
>
>And I want those two files will be:
>
><error.log>
> error message
>
><debug.log>
> error message
> warning message
>
>
>I cannot find out any sample log4j.properties in neither short manual nor
>FAQ.
>
>Thanks in advance,
>
>-------------------------------
>Wataru Fukushima
>PFU LIMITED
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>