1

I've seen tons of materials on how to use AsyncAppender in log4j.xml. However, I can't use a xml configuration, as I'm using Jboss Fuse - and this technology only allows .properties configuration.

Is there a way to translate the following configuration to .properties?

<appender name="async" class="org.apache.log4j.AsyncAppender">
  <param name="BufferSize" value="500"/>
  <appender-ref ref="console"/>
</appender>

I'd imagine that a solution looks somewhat like that:

log4j.appender.async=org.apache.log4j.AsyncAppender
log4j.appender.async.appenders=console
3
  • Does this mean the AsyncAppender requires XML configuration? Can .xml and .properties co-exist? Commented May 21, 2018 at 20:40
  • Yes, AFAIK AsyncAppender requires XML configuration. In my case I was using ops4j-logging (bundled with Jboss Fuse), so I was able to use an ops4j feature described in the answer, to use properties configuration for this problem. Commented May 24, 2018 at 9:07
  • 1
    I ended up writing the config programmatically. Thanks Commented May 24, 2018 at 16:29

1 Answer 1

2

According to documentation, this is not possible in property configurer:

https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html

However, as I'm using Jboss Fuse and Jboss Fuse is using ops4j pax-logging, it has been solved and the configuration I submitted

log4j.appender.async.appenders=console

does work in Jboss Fuse

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.