Re: Problem with Log4j (Configuration)

2004-12-21 Thread Jacob Kjome
At 12:35 AM 12/22/2004 -0500, you wrote:
>
>thanks Jake, its working...:)
>
>but whats the detailed solution if i required two different configuration
>files.
>
You'll have to come up with a repository selector that doesn't currently 
exist (that I know of) which supports differentiation of logger 
repositories based, somehow, on packages or something you make up.  For an 
example, see the ContextJNDISelector in Log4j-1.3 (in CVS)...
http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/selector/ContextJNDISelector.java

You can also read Ceki's writings on the topic...
http://www.qos.ch/logging/sc.jsp
I would just keep in mind that this is going to be awfully non-standard and 
this really should all be controlled from a single config file.  When 
requirements like this come down the pipe, it is usually because the 
requester of the "feature" doesn't really understand what they are asking 
for and doesn't realize that it would be done more properly another 
way.  That's when I step in and try to explain how a more standard solution 
would get them exactly what they want without going through the hoops 
involved in their uninformed proposed solution.

Jake

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


Re: Problem with Log4j (Configuration)

2004-12-21 Thread Ran//-\\mir

thanks Jake, its working...:)



but whats the detailed solution if i required two different configuration 
files.









 --- On Sat 12/18, Jacob Kjome < [EMAIL PROTECTED] > wrote:

From: Jacob Kjome [mailto: [EMAIL PROTECTED]

To: log4j-user@logging.apache.org

Date: Sat, 18 Dec 2004 11:31:45 -0600

Subject: Re: Problem with Log4j (Configuration)



At 05:20 PM 12/18/2004 +0100, you wrote: > >Amir, > >Are A.txt 
and B.txt the configuration files or the files where logging >output 
goes? >I'm pretty sure he means that the .txt files are his log 
files and since he has two separate configurations, he expects appA's 
output to go to one file (as it was configured in his appA config file) and 
he expects appB's output to go to separate file (as it is configured in his 
appB config file).  The problem is that there is only one config [file] per 
logger repository.  When he says "appA" and "appB", he means two jar files 
in the same application.The answer to this is that the approach is 
flawed.  The way I interpret this is that ApplicationA.jar and 
ApplicationB.jar both have a log4j config file in their roots.  This is a 
bad practice as someone else may use, for instance, ApplicationA.jar in 
their app but not want to have ApplicationA.jar defining their logger 
configuration.  The problem is thinking that configuration is happening 
per/library.  It actually happens per logger repository which, by default, 
is essentially per visible classloader hierarchy.  If a repository selector 
is used, the configuration happens per whatever criteria the selector uses 
as a demarcation of logger repositories.  This can add complexity which is 
necessary at times, but probably not here.Because of this, one 
should not distribute config files in jars.  Logging is for the end user, 
not the creator of the library.  Remove the config files from the libraries 
and use a single config file per/application.  At this point, it is easy to 
send the output of the two libraries (with distinct package names) to 
separate log files...  
I hope that answers the 
question.Jake >At 06:13 AM 12/17/2004, Ran//-\\mir wrote: 
> >>Apologies are mine if this issue is discussed already. >>I have two 
different applications i-e two separate jar files >>(ApplicationA.jar and 
ApplicationB.jar). >>Both use log4j for logging to separate files (A.txt 
and B.txt). >>Now the scenario is >>ApplicationB uses ApplicationA jar 
file. I have placed ApplicationA.jar >>and log4j.jar in WEB_INF/lib folder 
of ApplicationB. When ApplicationB >>runs, I expect to get logs in 
different files but unfortunately this does >>not happen. ApplicationA 
makes some logging in B.txt and ApplicationB in >>A.txt. Though both are 
using different configuration files. >>Is this normal? What is the solution 
to the problem? >>Thanking in advance. >>Amir > >-- >Ceki 
Gülcü > >   The complete log4j manual: http://qos.ch/log4j/ > 
> > 
>- >To 
unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: 
[EMAIL PROTECTED] > >  
-To
 unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: 
[EMAIL PROTECTED]

___
No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com

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



Re: Problem with Log4j (Configuration)

2004-12-21 Thread Ran//-\\mir

For some reasons it is required ro use different configuration files... 



so whats the second solution of the problem?







 --- On Sat 12/18, Jacob Kjome < [EMAIL PROTECTED] > wrote:

From: Jacob Kjome [mailto: [EMAIL PROTECTED]

To: log4j-user@logging.apache.org

Date: Sat, 18 Dec 2004 11:31:45 -0600

Subject: Re: Problem with Log4j (Configuration)



At 05:20 PM 12/18/2004 +0100, you wrote: > >Amir, > >Are A.txt 
and B.txt the configuration files or the files where logging >output 
goes? >I'm pretty sure he means that the .txt files are his log 
files and since he has two separate configurations, he expects appA's 
output to go to one file (as it was configured in his appA config file) and 
he expects appB's output to go to separate file (as it is configured in his 
appB config file).  The problem is that there is only one config [file] per 
logger repository.  When he says "appA" and "appB", he means two jar files 
in the same application.The answer to this is that the approach is 
flawed.  The way I interpret this is that ApplicationA.jar and 
ApplicationB.jar both have a log4j config file in their roots.  This is a 
bad practice as someone else may use, for instance, ApplicationA.jar in 
their app but not want to have ApplicationA.jar defining their logger 
configuration.  The problem is thinking that configuration is happening 
per/library.  It actually happens per logger repository which, by default, 
is essentially per visible classloader hierarchy.  If a repository selector 
is used, the configuration happens per whatever criteria the selector uses 
as a demarcation of logger repositories.  This can add complexity which is 
necessary at times, but probably not here.Because of this, one 
should not distribute config files in jars.  Logging is for the end user, 
not the creator of the library.  Remove the config files from the libraries 
and use a single config file per/application.  At this point, it is easy to 
send the output of the two libraries (with distinct package names) to 
separate log files...  
I hope that answers the 
question.Jake >At 06:13 AM 12/17/2004, Ran//-\\mir wrote: 
> >>Apologies are mine if this issue is discussed already. >>I have two 
different applications i-e two separate jar files >>(ApplicationA.jar and 
ApplicationB.jar). >>Both use log4j for logging to separate files (A.txt 
and B.txt). >>Now the scenario is >>ApplicationB uses ApplicationA jar 
file. I have placed ApplicationA.jar >>and log4j.jar in WEB_INF/lib folder 
of ApplicationB. When ApplicationB >>runs, I expect to get logs in 
different files but unfortunately this does >>not happen. ApplicationA 
makes some logging in B.txt and ApplicationB in >>A.txt. Though both are 
using different configuration files. >>Is this normal? What is the solution 
to the problem? >>Thanking in advance. >>Amir > >-- >Ceki 
Gülcü > >   The complete log4j manual: http://qos.ch/log4j/ > 
> > 
>- >To 
unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: 
[EMAIL PROTECTED] > >  
-To
 unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: 
[EMAIL PROTECTED]

___
No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com

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



Re: Custom subject with SMTPAppender?

2004-12-21 Thread Kevin A. Burton
Ceki Gülcü wrote:
At 10:57 PM 12/21/2004, you wrote:
Kevin A. Burton wrote:
It doesn't appear theres a way to set the Subject of an email based 
on a ConversionPattern.
Am I wrong? I hope so!

Ah... looks like this is a feature in 1.3alpha... Can't wait! :).
That and the %throwable conversion pattern will be killer!

I suppose you already know about the %C, %class, %F, %file, %L, %line, 
%M, %method conversion words right?
Yeah... thats awesome too.  I need the full stack trace in some 
situations though. 

Mostly when I have a situation that isn't an exception but I want to 
know when it happens so I can see what triggered it.

Kevin
--
Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
   
Kevin A. Burton, Location - San Francisco, CA
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412

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


The date and time not showing up in the log file

2004-12-21 Thread manoj JC
I have three log files set up in my log4j.properties.
The last one is not displaying the dates of the log entries. Three log files 
are created and the messages are getting logged to the corresponding log 
files. But the date and time is not showing up.

This is the log4j.proprties file that I am using.
log4j.rootLogger = INFO, C
# console appender
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
## general appender, set to INFO for now ##
log4j.logger.com.company1.apps.package1 = @LOGLEVEL@, test1.app
log4j.appender.test1.app = org.apache.log4j.RollingFileAppender
log4j.appender.test1.app.MaxFileSize=500KB
# Keep one backup file
log4j.appender.test1.app.MaxBackupIndex=2
log4j.appender.test1.app.File = /opt/log/test1.app.txt
log4j.appender.test1.app.layout = org.apache.log4j.PatternLayout
log4j.appender.test1.app.layout.ConversionPattern = %d %-5p %c - %m %n
log4j.additivity.com.company1.apps.package1 = false
## struts log ##
[EMAIL PROTECTED]@, test2.struts
log4j.appender.test2.struts = org.apache.log4j.RollingFileAppender
log4j.appender.test2.struts.MaxFileSize=500KB
# Keep one backup file
log4j.appender.test2.struts.MaxBackupIndex=2
log4j.appender.test2.struts.File = /opt/log/test2.struts.txt
log4j.appender.test2.struts.layout = org.apache.log4j.PatternLayout
log4j.appender.test2.struts.layout.ConversionPattern = %d %p (%F:%L) - %m%n
log4j.additivity.com.company1.apps.package1.struts = false
## World Check File Download log ##
log4j.logger.com.semagix.apps.package1.util=INFO, test3.util
log4j.appender.test3.util = org.apache.log4j.RollingFileAppender
log4j.appender.test3.util.MaxFileSize=500KB
# Keep one backup file
log4j.appender.test3.util.MaxBackupIndex=2
log4j.appender.test3.util.File = /opt/log/test3.txt
log4j.appender.test3.util.layout = org.apache.log4j.PatternLayout
log4j.appender.test3.util.layout.ConversionPattern = %d %-5p %c - %m %n
log4j.additivity.com.semagix.apps.package1.util = false

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


Re: Custom subject with SMTPAppender?

2004-12-21 Thread Ceki Gülcü
At 10:57 PM 12/21/2004, you wrote:
Kevin A. Burton wrote:
It doesn't appear theres a way to set the Subject of an email based on a 
ConversionPattern.
Am I wrong? I hope so!
Ah... looks like this is a feature in 1.3alpha... Can't wait! :).
That and the %throwable conversion pattern will be killer!
I suppose you already know about the %C, %class, %F, %file, %L, %line, %M, 
%method conversion words right?


Kevin
--
--
Ceki Gülcü
  The complete log4j manual: http://qos.ch/log4j/

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


Re: Custom subject with SMTPAppender?

2004-12-21 Thread Kevin A. Burton
Ceki Gülcü wrote:
It's a very recently introduced feature in 1.3, you have to get it 
from CVS. (It's not even in alpha-3.)
Yeah... I was just poking through and found that... pretty cool.
Kevin
--
Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
   
Kevin A. Burton, Location - San Francisco, CA
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412

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


Re: Custom subject with SMTPAppender?

2004-12-21 Thread Kevin A. Burton
Kevin A. Burton wrote:
It doesn't appear theres a way to set the Subject of an email based on 
a ConversionPattern.
Am I wrong? I hope so!
Ah... looks like this is a feature in 1.3alpha... Can't wait! :).
That and the %throwable conversion pattern will be killer!
Kevin
--
Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
   
Kevin A. Burton, Location - San Francisco, CA
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412

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


Re: Custom subject with SMTPAppender?

2004-12-21 Thread Ceki Gülcü

At 10:35 PM 12/21/2004, you wrote:
It doesn't appear theres a way to set the Subject of an email based on a 
ConversionPattern.
Am I wrong?  I hope so!
It's a very recently introduced feature in 1.3, you have to get it from 
CVS. (It's not even in alpha-3.)

Kevin
--
Ceki Gülcü
  The complete log4j manual: http://qos.ch/log4j/

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


Custom subject with SMTPAppender?

2004-12-21 Thread Kevin A. Burton
It doesn't appear theres a way to set the Subject of an email based on a 
ConversionPattern. 

Am I wrong?  I hope so!
Kevin
--
Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
   
Kevin A. Burton, Location - San Francisco, CA
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412

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


Re: SMTPAppender using dedicate threads?

2004-12-21 Thread Curt Arnold
On Dec 21, 2004, at 1:42 PM, Kevin A. Burton wrote:
Kevin A. Burton wrote:
Transport.send() usually blocks.
It seems to make sense to add a param to SMTPAppender to simply 
accept messages for delivery and them hand them off to a dedicated 
thread so that hte caller can return from log.info()...

Thoughts?
FYI... I was thinking on the way home that one could register their 
OWN transport which was threaded. The only problem is that the 
Transport class assumes its synchronous.

Though you could forward all these methods to the threaded class.
Have you tried encapsulating the SMTPAppender in an AsyncAppender?  
Were there problems with that approach?

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


Re: SMTPAppender using dedicate threads?

2004-12-21 Thread Kevin A. Burton
Kevin A. Burton wrote:
Transport.send() usually blocks.
It seems to make sense to add a param to SMTPAppender to simply accept 
messages for delivery and them hand them off to a dedicated thread so 
that hte caller can return from log.info()...

Thoughts?
FYI... I was thinking on the way home that one could register their OWN 
transport which was threaded. The only problem is that the Transport 
class assumes its synchronous.

Though you could forward all these methods to the threaded class.
Kevin
--
Use Rojo (RSS/Atom aggregator).  Visit http://rojo.com. Ask me for an 
invite!  Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
If you're interested in RSS, Weblogs, Social Networking, etc... then you 
should work for Rojo!  If you recommend someone and we hire them you'll 
get a free iPod!
   
Kevin A. Burton, Location - San Francisco, CA
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412

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