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 Guruprasanth <gu...@tarangtech.com> on 2004/04/26 16:04:26 UTC
setting separate log files for debug,info and error messges log
hi,
i need to have a separate log files for error,info and debug for my application.how do i set it in property file of log4j
regards
guru
Different Layouts for different levels
Posted by Rostislav Svoboda <bo...@pobox.sk>.
Hi all
Is it possible to set different Pattern Layouts for different levels and
thus to save messages to one logfile in a different format?
If yes does anyone know how to configure the log4j.properties ?
thx & EOF
Bost
========================================================================
An example:
the logfile in format:
<Method_M>
<DEBUG text="variable c is null"></DEBUG>
</Method_M>
<Method_N>
<DEBUG text="variable d is XXX"></DEBUG>
</Method_N>
is produced by code:
public void Method_M(String c)
{
logger.info("Method_M"); // Method_M: Starting ...
logger.debug("variable c is: " + c);
// ... execute Method_M
logger.info("/Method_M"); // Method_M: Done
return;
}
public void Method_N(String d)
{
logger.info("Method_N"); // Method_N: Starting ...
logger.debug("variable d is " + d);
// ... execute Method_N
logger.info("/Method_N"); // Method_N: Done
return;
}
so for INFO level i want to use
ConversionPattern=<%m>%n
and for DEBUG level i want to use
ConversionPattern=<%p text="%m"><%p>%n
Such pseudo XML format allows me to view the logfile in a XML viewer as a tree
so i can collapse uninteresting parts of logfile
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: setting separate log files for debug,info and error messges log
Posted by Guruprasanth <gu...@tarangtech.com>.
hi,
the link given by u below helps me to set up the application for setting
different log file for diferent error message.For example if i try for error
message iam able to get error message in separate log file.Similarly if i
try for different message iam able to get it.But in the same property file
if i want to printl error,debug and info all together in 3 different
property file iam gtting only one.
what i mean to say is the approach using filters works well for one error
message at a time when i try 3 different message for 3 different log files
it works only for error message.
regards
guru
----- Original Message -----
From: "Jacob Kjome" <ho...@visi.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Monday, April 26, 2004 8:28 PM
Subject: Re: setting separate log files for debug,info and error messges log
> Quoting Guruprasanth <gu...@tarangtech.com>:
>
> > hi,
> > i need to have a separate log files for error,info and debug for my
> > application.how do i set it in property file of log4j
> >
> > regards
> > guru
>
>
> http://wiki.apache.org/logging-log4j/Log4JProjectPages/LogByLevel
>
>
> Jake
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: setting separate log files for debug,info and error messges log
Posted by Jacob Kjome <ho...@visi.com>.
Quoting Guruprasanth <gu...@tarangtech.com>:
> hi,
> i need to have a separate log files for error,info and debug for my
> application.how do i set it in property file of log4j
>
> regards
> guru
http://wiki.apache.org/logging-log4j/Log4JProjectPages/LogByLevel
Jake
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org