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 De Moor Dries <dr...@awe.be> on 2003/04/03 16:20:41 UTC

Logging from same class to 2 different log files and each configu red with its own level

Hello,

In the application I'm writing I need to log 2 things. 
First of all information to a log file called app.log ( ERROR, DEBUG, INFO,
... )
Secondly I have to log some information into a file cumul.log  ( only INFO)

I thought to  define 2 separate property files bu I think this won't work.
I might be better to define two appenders but how to set the log levels. 
And how to prevent that ERROR, DEBUG INFO log messages end up in the
CUMUL.log file.


Any advice on this topic. Maybe I'm totally wrong?


Kind regards,


Dries

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


Re: Logging from same class to 2 different log files and each configu red with its own level

Posted by Thomas Lionel SMETS <ts...@altern.org>.
Unless you really want to manually process the file...
Smthg like :
    cat app.log | grep INFO >  cumul.log


I think you are better to use to different loggers.
Naming them should take into consideration why you want to make this 
differenciation.
We push ALL the SQL's  going tru' a sort of SQL-pooler to a special 
'sql.log', but I created a special entry in the hierarchy to have that:
<snip>
    Logger log = Logger.getLogger (this.getName ().getClass ());
    Logger sql = Logger.getLogger (this.getName ().getClass () + ".sql");
</snip>


Thomas,


De Moor Dries wrote:

>Hello,
>
>In the application I'm writing I need to log 2 things. 
>First of all information to a log file called app.log ( ERROR, DEBUG, INFO,
>... )
>Secondly I have to log some information into a file cumul.log  ( only INFO)
>
>I thought to  define 2 separate property files bu I think this won't work.
>I might be better to define two appenders but how to set the log levels. 
>And how to prevent that ERROR, DEBUG INFO log messages end up in the
>CUMUL.log file.
>
>
>Any advice on this topic. Maybe I'm totally wrong?
>
>
>Kind regards,
>
>
>Dries
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>  
>



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