14 messages in org.apache.logging.log4j-userRe: Fw: ThreadLocalAppender for log4j...
FromSent OnAttachments
Ramakrishna MenonMar 1, 2004 5:25 pm 
Ceki GülcüMar 2, 2004 2:18 am 
Ramakrishna MenonMar 2, 2004 7:26 am 
Ceki GülcüMar 2, 2004 8:13 am 
Paul SmithMar 2, 2004 11:56 am 
Ramakrishna MenonMar 2, 2004 12:12 pm 
Paul SmithMar 2, 2004 1:22 pm 
Ramakrishna MenonMar 2, 2004 3:33 pm 
Paul SmithMar 2, 2004 3:42 pm 
Ramakrishna MenonMar 2, 2004 4:36 pm 
Ramakrishna MenonJun 23, 2004 9:11 am 
Ramakrishna MenonJun 25, 2004 9:44 am 
Paul SmithJun 27, 2004 2:53 pm 
Ramakrishna MenonJun 28, 2004 8:39 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Fw: ThreadLocalAppender for log4j? resendingActions...
From:Ceki Gülcü (ce@qos.ch)
Date:Mar 2, 2004 2:18:06 am
List:org.apache.logging.log4j-user

There is no such appender to my knowledge.

If I understand correctly, you would like to limit log entries to a specific thread. If that is the case, I don't see a thread local appender will help.

At 05:26 PM 3/1/2004 -0800, you wrote:

Not sure if you got this. Resending it... Thanx! Best Regards, Menon:) ------------------------------------------------------------- Ramakrishna M. Menon (A Rafi Fan - http://www.mohdrafi.com ) MBA, Berkeley Oracle Corp.-> (650) 506-2343 http://websites.oraclecorp.com/websites/pub/oracleperformance/ -------------------------------------------------------------

Folks My first question to the list - and I admit I am not a log4j pro:-) - I did look around quite a bit before posting...

Basically, the requirement is very simple:

We are using J2EE infrastructure (jsp, middle tier code accessing data in the database) to render UI. During the UI rendering the code in middle tier accesses the database. Currently, log4j is being used to log the middle tier code. I want to intercept the log4j messages transaprently and store them in a ThreadLocal variable in the servlet. This would be helpful in dumping the UI instrumentation code in the middle tier to the URL being rendered based on a URL flag ( e.g. you can change a url http://myapp/mypage to http://myapp/mypage$debug=1

to dump all the middle tier UI rendering logic in the URL. I want this to happen without changig the current log4j instrumentation code. This means I need to intercept and channel the log4j messages to a ThreadLocal variable ..Hence I thought of writing a ThreadLocalAppender (I am almost done with it.) I basically extended from the AppenderSkeleton for my ThreadLocalAppender and overrode the activateOptions, checkEntryConditions() and subAppend methods. My question is: 1. Is this kind of Appender available already? 2. Is my thinking correct in general about creating a separate Appender class to channel the log4j messages transparently. 3. Does it make sense to submit the code for this Appender so that it can be used correctly? 4. Any other comments?

Thanx a bunch!

Best Regards, Menon:) ------------------------------------------------------------- Ramakrishna M. Menon (A Rafi Fan - http://www.mohdrafi.com ) MBA, Berkeley Oracle Corp.-> (650) 506-2343 http://websites.oraclecorp.com/websites/pub/oracleperformance/ -------------------------------------------------------------

----- Original Message ----- From: "Scott Deboy" <sde@comotivsystems.com> To: "Log4J Users List" <log4@logging.apache.org> Sent: Sunday, February 29, 2004 12:39 PM Subject: RE: pattern and chainsaw

I agree, log files stored in a non-XML format should be viewable in Chainsaw v2.

I contributed a Receiver which provides Log4J (and Chainsaw v2) the ability to process events stored in a logfile written using an arbitrary format (PatternLayout).

In order to use this receiver, follow the instructions in the 'installation' section of the Chainsaw v2 page and use the XML configuration provided below

Here's a link to the Chainsaw v2 page: http://logging.apache.org/log4j/docs/chainsaw.html

See the javadoc of the new Receiver for an explanation of the available keywords used by the the 'logFormat' param:


http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java?rev=1.1&view=auto

Here is the example XML configuration, which can load events written to disk using this PatternLayout format: %r [%t] %-5p %c %x - %m%n

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"> <plugin name="LogFileReceiver" class="org.apache.log4j.varia.LogFilePatternReceiver"> <param name="timestampFormat" value="yyyy-MM-d HH:mm:ss,SSS"/> <param name="logFormat" value="RELATIVETIME [THREAD] LEVEL LOGGER * - MESSAGE"/> <param name="fileName" value="c:/logs/A4.log"/> </plugin> <root> <level value="debug"/> </root> </log4j:configuration>

If anyone has questions, let me know

Scott

-----Original Message----- From: Jean Charles Jabouille [mailto:JEAN@BULL.NET] Sent: Fri 2/27/2004 1:16 AM To: Log4J Users List Cc: Subject: Re: pattern and chainsaw i'm ok with you, but i don't want a XML file. I want a .log file. I want to use the chainsaw v1. And when i open chainsaw and submit my log file, it's found "0 events". I think that's a pattern problem. So i'dlike to know the standard pattern for Chainsaw v1.

Thanks for your reply

Scott Deboy wrote:

Chainsaw can display log files which were formatted using XMLLayout.

The version of Chainsaw in CVS - see http://logging.apache.org/log4j/docs/chainsaw.html - can also display jdk1.4 util.logging files if they were formatted using XMLFormatter.

Replace the layout specified in your file appender with this:

<layout class="org.apache.log4j.xml.XMLLayout"/>

Scott

-----Original Message----- From: Jean Charles Jabouille [mailto:JEAN@BULL.NET] Sent: Thursday, February 26, 2004 4:21 AM To: log4@logging.apache.org Subject: pattern and chainsaw

Hi,

i'd'like to know if there is a specific pattern for log in order to be used with Chainsaw.

My layout is file.log

Thanks for your reply

--------------------------------------------------------------------- To unsubscribe, e-mail: log4@logging.apache.org For additional commands, e-mail: log4@logging.apache.org

-------------------------------------------------------------------------- -- ----

-- Ceki Gülcü

For log4j documentation consider "The complete log4j manual" ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp