logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Blaine Bergeson (bbergeson)" <bberge...@micron.com>
Subject Observations about the Context Map and the Header attribute
Date Sat, 17 Jan 2015 08:18:56 GMT
Here are some things I have observed when trying to use the context map and the header attribute
for a pattern.  Are these bugs or are they suppose to work this way?

  1.   When I try to use the context map values in the header attribute of a patternLayout
of a RollingRandomAccessFile appender the values are not available the first time the log
file is created but they do become available when the log is created as part of a rollover
event.  It seems that a rollover must occur before the context values are available to the
header attribute.  Also, if I make the logger and/or appender async then the values also don’t
seem to be available even though I have the location attribute set to true on the async logger
and the async ref appender.
  2.  If I add items to the context map from within a specific class those values will not
be available to the Root logger.  I have to define at least 1 logger that is defined with
a portion of the path to the class where the items were added.  For example if I have a class
called com.sample.MyClass then any items I add to the context map will be available to a logger
defined as at least com, but the Root Logger and any appender used by the Root logger will
not see them.
  3.  It appears that the header attribute value can’t use any of the formatting or substitution
features, i.e. it has to be an exact string.  This means that to enter the date, time, or
just a  newline I have to add it to the end of the string that is entered in the context map
in the application rather than just adding it in the configuration file.
  4.  When the appender is stdout it won’t display the header attribute value.

Blaine

Sent from my iPhone

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

Mime
View raw message