Using a single utility class to log messages is exactly against the log4j
paradigm. Log4J allows different classes to have their own individually
configured logger instances according to your wishes as specified in the
*.properties or *.xml file. The utility class would itself be using only a
single log4j logger which has only a single level, which unfortunately
removes one of LOG4J greatest design strengths.

At 10:48 AM 29/10/2003 -0500, you wrote:
>
>
>This should help.
>
>http://www.mail-archive.com/[EMAIL PROTECTED]/msg01682.html
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, October 29, 2003 10:29 AM
>To: [EMAIL PROTECTED]
>Subject: File name and Line number problem
>
>
>Hi,
>
>I am trying to implement log4j across the entire project, there are about
>1000 files in the project.
>
>What I have done is to have a utility class Log4j.java and thru my startup
>program initialize
>all the default log4j properties. (loggers,appender etc.) from the
>specified property file
>All of the other programs just invoke the method
>com.abc.util.Log4j.log("some string") method.
>
>Everything works great up and all messages get trapped to the specified
>appender except
>for this one issue.
>
>The file and line number I specify correspond to the utility class and not
>the actual class that is printing this message.
>when I use the conversion pattern (%F:%L)
>
>E.g. If there is this class - Example.class and at line#35
>there is a statment com.abc.util.Log4j.log("Test message");
>
>The file name printed on the log file corresponds to the Log4j.java and the
>line number corresponds
>to the log method in that file.
>
>Best regards,
>Sre
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>---------------------------------------------------------------------------
----
>This message and any included attachments are from Siemens Medical Solutions 
>USA, Inc. and are intended only for the addressee(s).  
>The information contained herein may include trade secrets or privileged or 
>otherwise confidential information.  Unauthorized review, forwarding,
printing, 
>copying, distributing, or using such information is strictly prohibited
and may 
>be unlawful.  If you received this message in error, or have reason to
believe 
>you are not authorized to receive it, please promptly delete this message
and 
>notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you
>
>---------------------------------------------------------------------
>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]

Reply via email to