You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2005/03/21 06:14:12 UTC
Re: Can ConversionPatterns for PatternLayout Layout of a
FileAppender be switched during execution?
I don't recall if this is possible or not? However, since Log4j is
programatically configurable, you may be able to write or find a runtime
configuration utility that can do what you need. An example of this is the
ConfigurationServlet in the log4j sandbox. There is also an enhanced
version of this in the wiki...
http://wiki.apache.org/logging-log4j-data/attachments/UsefulCode/attachments/ConfigurationServlet.java
To see how this one differs from the one in the sandbox, see...
http://wiki.apache.org/logging-log4j/UsefulCode
There are also a few listed on the third party utility list of Log4j's site...
http://logging.apache.org/log4j/docs/download.html
If none of these quite suit your need, you can always write it yourself.
Jake
At 06:32 PM 3/17/2005 -0600, you wrote:
>I need to use FileAppender to log a program's messages to a single file.
>
>During execution of the program, I would like to change the
>ConversionPattern
>for the PatternLayout standard layout, so that the logged messages format
>changes.
>
>I would like to know if this can be done and how?
>
>
>My understanding from the FAQ in the "Complete log4j Manual" is
>that multiple appenders running in the same JVM cannot log to the same file.
>
>So, that makes me think that I cannot define in my config file different
>FileWriter appenders that have
>different ConversionPatterns for PaternLayout layout and then create
>diferent
>loggers in the different places of my program where I want to switch the
>Conversion Pattern for
>the data going to this log file.
>
>Can I somehow programatically, during execution, either:
>
>- change/re-define the Conversion Pattern on the PatternLayout for an
>existing appender?
>
>or
>
>- change/switch the layout for an exiting layout of the appender, in order
>to redefine the ConversionPattern
>for that PatternLayout
>
>or
>
>can I somehow create a new appender with the same name but different layout
>so that the
>program continues to use just one appender to the same file??
>
>Any ideas would be appreciated.
>
>Jim
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org