Reputation: 1378
I am using Log4j for logging my application activity. In my local environment it was logging like
Fiilename:linenumber: your logging message
then I created archive and deploy in another environment then its logging without file name, can any one clear me which property if logger do this. thanks
Upvotes: 4
Views: 8336
Reputation: 15070
In log4j.properties file set
log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p %l - %m%n
Here %l specifies to generate the location information. According to the spec for PatternLayout : "The location information depends on the JVM implementation but usually consists of the fully qualified name of the calling method followed by the callers source the file name and line number between parentheses."
Upvotes: 5
Reputation: 22514
Look at the documentation for PatternLayout. Note that figuring out file name and file number is slow (I guess it involves getting a stack trace and analyzing it).
Upvotes: 3