Of course. MDC content is kept on a per thread basis. Since each session is
handled in its own thread, you can put a value into the MDC somewhere at the
entry point of a session (and remove it again when session is finished). The
formatter of log4j (at least the PatternLayout) can retrieve this
Dear Matt Brown,
My JSP application also uses some Java classes. Your solution is
suitable for use inside those Java classes?
On Wed, Sep 30, 2009 at 15:40, Matt Brown wrote:
> I've implemented this before by writing a javax.servlet.Filter to add the
> SessionID to the MDC of every reques
I've implemented this before by writing a javax.servlet.Filter to add the
SessionID to the MDC of every request.
-Original Message-
From: Renan Vinícius Mozone [mailto:renan.moz...@gmail.com]
Sent: Wednesday, September 30, 2009 2:13 PM
To: log4j-user@logging.apache.org
Subject: Log sess
I'm planning to use log4j on a JSP based application. However, every log
entry must have a session identification. This session identification is in
a session variable.
How can I configure the formatter to achieve this?
The log entry must be something like this:
[TIMESTAMP] [THREA
I know that they are from different packages, Log is a wrapper for log4j or
other.
I'm trying to figure out why log4j's Logger doesn't work, while common's Log
works fine (in described situation). I want to use Logger instead of Log.
--
View this message in context:
http://www.nabble.com/Diff-be
Log and LogFactory are not log4j classes
(http://logging.apache.org/log4j/1.2/apidocs/index.html).
However they are both Commons Logging classes (
http://commons.apache.org/logging/commons-logging-1.1.1/apidocs/index.html ).
Are you using Commons Logging on accident?
Or are you trying to find
Hello! I faced with a such situation when Logger and Log act differently.
I configure my log4j with
DOMConfigurator.configureAndWatch(xmlFileName);
In the configure xml file there is defined only one appender - FileAppender.
So, when I'm using
Log log = LogFactory.getLog(name);
and then
log.i
Hi!
Thanks a lot for the reply, it did help *a lot* :-). I still have a few
concerns, though they're just things that surprise me rather than real
problems.
Bender Heri wrote:
>
> - If for some reasons you must load the configuration programmatically: a
> XML configuration should be loaded by
First:
For simple configuration needs (in fact for most configuration needs) you do
not need to call a configurator explicitely. Just put your config file in the
classpath, and log4j finds it for you and autoconfigures itself the first time
the LogManager is loaded (e.g. on a static Logger.getL