Providing access to log/appender in application

2019-08-15 Thread Fred Eisele
My current application has a "log panel" where certain messages are posted. We are converting this application to use log4j2. What is a good way to route an appender to an in memory list of messages in the application? * Construct an appender programmatically passing the java list to the construct

Re: Providing access to log/appender in application

2019-08-15 Thread Fred Eisele
. We make extensive use of this in > our unit tests. If you look at one of the tests that use it you can see how > it can be accessed from your code. Essentially, you get the configuration > from the LoggerContext and then find the appender you want from that. > > Ralph > > >

Changing the Attributes on a RollingAppender

2019-08-21 Thread Fred Eisele
Given a RollingFileAppender is it possible to dyanamically/programmatically change its fileName? I need to be able to change the log file from my running application plugin.

Re: Changing the Attributes on a RollingAppender

2019-08-21 Thread Fred Eisele
Could construct a new appender and swap it for the old one? On Wed, Aug 21, 2019 at 8:39 AM Ralph Goers wrote: > No. The file name is immutable. > > Ralph > > > On Aug 21, 2019, at 6:22 AM, Fred Eisele > wrote: > > > > Given a RollingFileAppender

Re: Changing the Attributes on a RollingAppender

2019-08-22 Thread Fred Eisele
o be able to change the log fileName and filePattern associated with a specific RollingAppender from my running application plugin. Is there a way to get an appender directly by name? > Ralph > > > On Aug 21, 2019, at 10:44 AM, Fred Eisele > wrote: > > > > Could construct

ConfigurationBuilder in Programmatic Configuration

2019-11-01 Thread Fred Eisele
ref: https://logging.apache.org/log4j/2.x/manual/customconfig.html#ConfigurationBuilder The ConfigurationBuilder is demonstrated in [ * https://logging.apache.org/log4j/2.x/manual/customconfig.html#Example * https://logging.apache.org/log4j/2.x/manual/customconfig.html#Configurator ] but not in [

Re: Changing the Attributes on a RollingAppender

2019-11-01 Thread Fred Eisele
I had not seen the RoutingAppender. It looks like it will do the trick. Thanks On 2019/08/22 13:19:59, "Carter Kozak" wrote: > Have you considered using a routing appender[1]? It can write to a specific file based on jvm system properties, thread context (MDC), or any other pattern parameter.> >

Re: Setting java system properties in Configuration

2020-04-09 Thread Fred Eisele
Is it possible to set default values for properties? Clearly global default properties can be set via the Properties element. 1. 2. value 3. 4. But I am referring to the java system properties. sys -> System properties. The formats are ${sys:some.property} and ${sys:some.property:-de

Formatting Results

2020-06-16 Thread Fred Eisele
When traceExit(m,r) is used... Is there a mechanism for controlling the formatting of the result? Other than overriding the 'toString()' method. When formatted messages are used and the object's class implements the StringBuilderFormattable interface the 'formatTo()' method is used preferentially o

Re: Formatting Results

2020-06-17 Thread Fred Eisele
gt; by the layout for serialization. What do you mean by "this does not > seem to be the case"? Would you mind elaborating a bit more on what > you're exactly trying to do? Further, a reproduction path will be > greatly appreciated. > > Kind regards. > > On Tue, J

Re: Formatting Results

2020-06-18 Thread Fred Eisele
check out the > > following AbstractLogger#traceExit() implementation: > > > > @Override > > public R traceExit(final Message message, final R result) { > > // If the message is null, traceEnter returned null because ... > > if (message != null && isEnable

Re: Programmatic configuration all or nothing?

2022-03-10 Thread Fred Eisele
I would like something similar. Maybe a way to initialize a builder with the current configuration? On Wed, Mar 2, 2022 at 11:14 PM Ralph Goers wrote: > As its name implies, ConfigurationBuilder creates a new Configuration. Any > Configuration you build this way would replace an existing Configu