Abgeschickt von christoph am 21 Juli, 2006 um 13:10:11
Antwort auf: how can i add log's methodname,line number,...log4j von suneel am 17 Juli, 2006 um 17:20:38:
use the pattern layout!
eg. the conversion pattern
%d{yyyy-MM-dd HH:mm:ss.SSS}#%5p#[%t]#%m#%C{1}#%M#%L#%n
contains
- the datetime (%d{format})
- the loglevel (%[N]p ... [N] being the 5 in my exampel, meaning the length of the sting... e.g. 5 chars)
- the message (%m)
- the calling Class (%C{[N]} ... [N] being the level in package... eg. you have a Classe called Logging in package java.logging.mylogging... and the class Logging contains the method initiation the logging... %C{1} deliveres the classname "Logging", %C{2} deliveres "mylogging.Logging", and so on)
- the calling Method (%M)
- the line where the call occures (%L)
using a layoutPartsDelimiter #!
i hope this helps,
christoph