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 rx...@netscape.net on 2002/07/13 17:45:11 UTC

Specifying exclusive log file for one category

I have a root category and other other categories under it instantiated as with their class name strings for logging. 

Now for just one of my classes i want the messages to go into a different log file (these messages should not appear in the main log where all other classes log their messages).

Is there any way to specify this in the Logger.properties file or some other way this can be achieved ?

Thanks & Regards.
Ravi


-- 
***************************************
...Tough times don't last, Tough People Do...
***************************************



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Specifying exclusive log file for one category

Posted by Ravishankar Rajagopalan <rx...@netscape.net>.
I set the additivity false at the end of my Logger.properties file. But 
Tomcat-uPortal's Logger.properties (which i understand executes after 
mine) seems to still over ride this and i find messages in both the logs 
after Tomcat starts up. Any other workaround that may work ?

Thanks
Ravi

soronthar@yahoo.com wrote:

> try setting the additivity of
> log4j.category.com.x.y.a1 and
> log4j.category.com.x.y.a2
> to false. I think is something like:
> 
> log4j.category.com.x.y.a1.Additivity=false
> log4j.category.com.x.y.a2.Additivity=false
> 
> This way the appenders are not inherited, so only the
> appenders you specify are used.
> 
> Perhaps you would want to try:
> log4j.category.com.x.Additivity=false
> 
> so you have complete control over the appenders of
> your particular hierarchy.
> 
> Hope this help,
> 
> Rafael Alvarez
> 
> --- Ravishankar Rajagopalan
> <rx...@netscape.net> wrote:
> 
> <some lines deleted>
> 
>>The objective is - messages from different modules
>>(categories) need to go into separate files
>>exclusively. Actually i tried to set it up in 
>>such a way  :
>>
>>log4j.category.com.x.y.a1=DEBUG, R
>>log4j.category.com.x.y.a2=DEBUG,AA
>>
>>and set separate appenders for R and AA, which works
>>perfectly fine.
>>
>>But we are using Tomcat-uPortal which has its own
>>Logger.properties file (so in our system we have two
>>
> 
>>of them) and it sets the log4j.rootCategory=DEBUG, R
>>and this makes all the messages to flow into 
>>this file as all other categories come under the
>>Root. Is there any way i can work-around this
>>(either by changing the Logger.properties of 
>>Tomcat-uPortal) or any other change ?
>>
>>Thanks & Regards.
>>Ravi
>>
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Specifying exclusive log file for one category

Posted by Rafael Alvarez <so...@yahoo.com>.
try setting the additivity of
log4j.category.com.x.y.a1 and
log4j.category.com.x.y.a2
to false. I think is something like:

log4j.category.com.x.y.a1.Additivity=false
log4j.category.com.x.y.a2.Additivity=false

This way the appenders are not inherited, so only the
appenders you specify are used.

Perhaps you would want to try:
log4j.category.com.x.Additivity=false

so you have complete control over the appenders of
your particular hierarchy.

Hope this help,

Rafael Alvarez

--- Ravishankar Rajagopalan
<rx...@netscape.net> wrote:

<some lines deleted>
> The objective is - messages from different modules
> (categories) need to go into separate files
> exclusively. Actually i tried to set it up in 
> such a way  :
> 
> log4j.category.com.x.y.a1=DEBUG, R
> log4j.category.com.x.y.a2=DEBUG,AA
> 
> and set separate appenders for R and AA, which works
> perfectly fine.
> 
> But we are using Tomcat-uPortal which has its own
> Logger.properties file (so in our system we have two

> of them) and it sets the log4j.rootCategory=DEBUG, R
> and this makes all the messages to flow into 
> this file as all other categories come under the
> Root. Is there any way i can work-around this
> (either by changing the Logger.properties of 
> Tomcat-uPortal) or any other change ?
> 
> Thanks & Regards.
> Ravi


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Specifying exclusive log file for one category

Posted by Ravishankar Rajagopalan <rx...@netscape.net>.
Hi :

The objective is - messages from different modules (categories) need to 
go into separate files exclusively. Actually i tried to set it up in 
such a way  :

log4j.category.com.x.y.a1=DEBUG, R
log4j.category.com.x.y.a2=DEBUG,AA

and set separate appenders for R and AA, which works perfectly fine.

But we are using Tomcat-uPortal which has its own Logger.properties file 
(so in our system we have two of them) and it sets the 
log4j.rootCategory=DEBUG, R and this makes all the messages to flow into 
this file as all other categories come under the Root. Is there any way 
i can work-around this (either by changing the Logger.properties of 
Tomcat-uPortal) or any other change ?

Thanks & Regards.
Ravi

kirusshna@cyberpros-us.com wrote:

> Hi ravi,
> 
> Try this change in the properties and in the java file also.
> 
> log4j.logger.Log1=DEBUG,Log1
> log4j.logger.Log2=DEBUG,Log2
> 
> log4j.logger=Log1
> log4j.logger=Log2
> 
> log4j.appender.Log1=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.Log1.layout=org.apache.log4j.HTMLLayout
> log4j.appender.Log1.File=F:/send/X1.html
> log4j.appender.Log1.datePattern='.'yyyy-MM
> 
> 
> log4j.appender.Log2=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.Log2.layout=org.apache.log4j.HTMLLayout
> log4j.appender.Log2.File=F:/send/X2.html
> log4j.appender.Log2.datePattern='.'yyyy-MM
> 
> in java file ,
> 
> public static Logger log1  = null;
>  public  static Logger log2  = null
> 
> log1  = Logger.getLogger("Log1");
> 
> log2 = Logger.getLogger("Log2");
> 
> and so u can call  log1.debug or log2.error ...
> 
> hope this will solve the problem.
> 
> kirusshna
> 
> 
> 
> 
> -----Original Message-----
> From: rxravishankar@netscape.net [mailto:rxravishankar@netscape.net]
> Sent: Saturday, July 13, 2002 8:45 AM
> To: log4j-user@jakarta.apache.org
> Subject: Specifying exclusive log file for one category
> 
> I have a root category and other other categories under it instantiated as
> with their class name strings for logging.
> 
> Now for just one of my classes i want the messages to go into a different
> log file (these messages should not appear in the main log where all other
> classes log their messages).
> 
> Is there any way to specify this in the Logger.properties file or some other
> way this can be achieved ?
> 
> Thanks & Regards.
> Ravi
> 
> 
> --
> ***************************************
> ...Tough times don't last, Tough People Do...
> ***************************************
> 
> 
> 
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas.
> Experience the convenience of buying online with Shop@Netscape!
> http://shopnow.netscape.com/
> 
> Get your own FREE, personal Netscape Mail account today at
> http://webmail.netscape.com/
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Specifying exclusive log file for one category

Posted by kirusshna <ki...@cyberpros-us.com>.
Hi ravi,

Try this change in the properties and in the java file also.

log4j.logger.Log1=DEBUG,Log1
log4j.logger.Log2=DEBUG,Log2

log4j.logger=Log1
log4j.logger=Log2

log4j.appender.Log1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Log1.layout=org.apache.log4j.HTMLLayout
log4j.appender.Log1.File=F:/send/X1.html
log4j.appender.Log1.datePattern='.'yyyy-MM


log4j.appender.Log2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Log2.layout=org.apache.log4j.HTMLLayout
log4j.appender.Log2.File=F:/send/X2.html
log4j.appender.Log2.datePattern='.'yyyy-MM

in java file ,

public static Logger log1  = null;
 public  static Logger log2  = null

log1  = Logger.getLogger("Log1");

log2 = Logger.getLogger("Log2");

and so u can call  log1.debug or log2.error ...

hope this will solve the problem.

kirusshna




-----Original Message-----
From: rxravishankar@netscape.net [mailto:rxravishankar@netscape.net]
Sent: Saturday, July 13, 2002 8:45 AM
To: log4j-user@jakarta.apache.org
Subject: Specifying exclusive log file for one category

I have a root category and other other categories under it instantiated as
with their class name strings for logging.

Now for just one of my classes i want the messages to go into a different
log file (these messages should not appear in the main log where all other
classes log their messages).

Is there any way to specify this in the Logger.properties file or some other
way this can be achieved ?

Thanks & Regards.
Ravi


--
***************************************
...Tough times don't last, Tough People Do...
***************************************



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>