[logback-user] Fwd: ContextSelector JNDI (in WildFly)

Janario janarioliver at gmail.com
Wed Apr 29 02:21:09 CEST 2015


Hi guys,

No updates here right?

Let me share what I've done.

Full replacement, I intended to remove all default log from wildfly and use
only Logback. Also I wanted to have log separation as in
http://logback.qos.ch/manual/loggingSeparation.html

So to integrate better I've created a subsystem
https://github.com/Janario/wildfly-logback-subsystem
To use it I have to:
- create a logback-default.xml that will be used by default context 
- from standalone.xml remove <extension module="org.jboss.as.logging"/> and
all <subsystem xmlns="urn:jboss:domain:logging:2.0"> body
More details of installation can be found here
https://github.com/Janario/wildfly-logback-subsystem#install


After integrate basically I've had 3 problems. Most of them is because some
static Logger instances are loaded from startup and attached with default
context logger.

- Level by context
After create Logger from default LoggerContext it still with same level. To
make this more dynamic I've created a TurboFilter that wrap all other
Filter. 
So from current LoggerContext if level is denied just deny, if level is
accepted and other filters are neutral just accept, otherwise the result of
others filters. 
see
https://github.com/Janario/wildfly-logback-subsystem/blob/master/src/main/java/me/janario/logback/deployment/impl/ContextualLevelDecisionTurboFilter.java#L28
With that I've made "contextual" level

- Appender by context
As in Level by context I've wrapped AppenderAttachableImpl and made decision
based on current LoggerContext. But I've supported only root Logger. It
would be difficult to replace all levels
see
https://github.com/Janario/wildfly-logback-subsystem/blob/master/src/main/java/me/janario/logback/deployment/impl/ContextualAppenderAttachable.java#L19

- Error on EJB async
On async calls it throws a NullPointerException because of null from
LogbackMDCAdapter.getCopyOfContextMap
That one I have no way to make it work without change Logback.


So, I know, work with wrapped instances is not the best way to work. I was
just looking for some points to share here and discuss a better integration
with Logback.

Is this already planned by logback team? 
Is there other ways to integrate contextual loggers with logback?




--
View this message in context: http://logback.10977.n7.nabble.com/Fwd-ContextSelector-JNDI-in-WildFly-tp14188p14205.html
Sent from the Users mailing list archive at Nabble.com.


More information about the Logback-user mailing list