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 Allistair Crossley <Al...@QAS.com> on 2004/05/12 10:16:35 UTC

Unknown Source problem (config and example included)

Hi All,

Our development effort has been a little hindered by Log4J's output not revealing line numbers for errors. I am sure there is a perfectly good reason for this although I have found a caveat.

A sample from our log4j.properties file is as follows to define a logger called Application. This is because we want our classes to use named loggers like Search, Content, Application and others rather than specifying the full class. We do this as follows;

log4j.logger.Application=debug, ApplicationA
log4j.appender.ApplicationA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ApplicationA.File=../logs/application.log
log4j.appender.ApplicationA.layout=org.apache.log4j.PatternLayout
log4j.appender.ApplicationA.layout.ConversionPattern=%d %-5p %l : %m%n

When our application logs to this particular log by

static Logger logger = Logger.getLogger("Application");

the following output is given;

2004-05-11 10:23:22,393 DEBUG com.qas.newmedia.intranet.iq.logic.core.stellent.StellentContentManagementSystemDAO.getWorkflows(Unknown Source) : wfProps={dRevLabel=1, dWfStepType=:R:C:CE:, dDocTitle=testy, dDocAccount=, dCheckoutUser=, dIsCheckedOut=, dDocType=Announcement, wfQueueEnterTs={ts '2004-05-11 10:23:17.614'}, dID=8524, dWfName=WF_Public, dWfStepName=iQTestPublishAuthorisation, wfQueueActionState=, dSecurityGroup=Public, dDocName=intratest_007129, dDocAuthor=daniele, dClbraName=, wfQueueLastActionTs={ts '2004-05-11 10:23:17.614'}}

The part I want to draw your attention to is the end of the method signature (Unknown Source) which is usually a line number. ALL our loggers log without the line number bere.

The interesting caveat is that I took the web application home a few weeks ago and installed it "as is". The logging statements *did* have a line number on my home machine.

I wonder if anyone knows what I could do about this?

Cheers, ADC.


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


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