I don't think you need to change log4j code to achieve that.

On 10/25/07, orko <[EMAIL PROTECTED]> wrote:
> Thanks for the feedback. I am still not sure exactly how it is working, but I 
> made it work. For future reference, I am explaining what I did.
> In the category.java file there is a variable called FQCN. I changed its 
> value towards my logging.java class name, so that it gets caller's parent 
> class. Thus it can detect which class it was originally called from. Both 
> file name and line number is working correctly.
> I had to run a build to get a working copy of jar.
> Thanks again for your response.
> -Orko
>
> Matthew Kemp <[EMAIL PROTECTED]> wrote: I'm not a 100% for sure about how 
> log4j gets the class info, but I believe
> it retrieves the previous value from the stack.
>
> So if your class/method that was performing logging was Foo/foo, normally
> the stack would look something like:
>
> Logger.log(xx)
> Foo.foo(xx)
> ...
>
> However with your intermediary class your stack looks like:
>
> Logger.log(xx)
> logging.log(xx)
> Foo.foo(xx)
> ...
>
> So when log4j tries to get the previous class it comes up with logging for
> every call.
>
> On 10/25/07, orko  wrote:
> >
> >   Hi every one,
> > I am trying to replace my current logging system into log4j. There is a
> > logging object (logging.java) which acts as a layer between logging system
> > and my application, so that other developers don't have to worry about this
> > change. So when a log method (debug, or trace) is called, it gets
> > initialized from this layer.
> >
> > I have been trying to understand how the file name and line number (%f,
> > %l) works.
> > I can see the pattern in appender objects. But can't find how these
> > (filename and linenumber) are getting initialized. It always gives me
> > logging.java as file name instead of the file name where it was first
> > called. Does any one have any idea how it is really working?
>
>


-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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

Reply via email to