I'm currently migrating old web apps from JBoss As 4.2.2 to 6.0.0 (AS6). In AS6 we have a proprietary format for logging applications through a file named jboss-logging.xml
.
After read some stuff (http://community.jboss.org/wiki/SeparatingApplicationLogs) reach the conclusion that "(...)starting with JBoss AS 6.0.0.M2 the ability to log to separate log files, per application, will be implemented in a different way" and also that the documentation "(...) will be updated with more details, once the implementation is ready".
However I was able to create the specific application log files in my server/log
dir, it was done using the main joboss-logging.xml
file in the server/deploy
dir. This is not compatible with the modularity my applications demand.
So here the problem when I create a jboss-logging.xml
e my WEB-INF
dir for my app whit this configuration:
<?xml version="1.0" encoding="UTF-8"?>
<logging xmlns="urn:jboss:logging:6.0" xmlns:b="urn:jboss:bean-deployer:2.0" context="myApp">
<define-context name="myApp" />
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/myApp.log"
name="WEBAPP" autoflush="true" append="true" suffix=".yyyy-MM-dd">
<error-manager><only-once/></error-manager>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<root-logger>
<!-- Set the root logger priority via a system property, with a default value. -->
<level name="${jboss.server.log.threshold:INFO}"/>
<handlers>
<handler-ref name="WEBAPP"/>
</handlers>
</root-logger>
</logging>
I get the following error when my app starts:
8:57:07,765 ERROR [AbstractKernelController] Error installing to Configured: name=Logging:REGISTRATION:myApp:Anonymous-0 state=Instantiated: java.lang.RuntimeException: Error configuring property: selector for Logging:REGISTRATION:myApp:Anonymous-0
at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
(...)
Caused by: java.lang.IllegalArgumentException: Wrong arguments. setSelector for target org.jboss.logging.metadata.ClassLoaderRegistrationHelper@1a4eb51 expected=[org.jboss.logmanager.ClassLoaderLogContextSelector] actual=[org.jboss.logmanager.LogContextSelectorService]
at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:404) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:74) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.AbstractBeanInfo.setProperty(AbstractBeanInfo.java:289) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.PropertyDispatchWrapper.execute(PropertyDispatchWrapper.java:114) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:107) [jboss-kernel.jar:2.2.0.GA]
... 64 more
I will be grateful for any kind of info or direction on this subject, even one that represents using a complete different approach to logging in AS6. Although I feel I'm getting closer to the solution... Thank you in advance.
The post here is also mine
This is a bug, it's reported here: https://issues.jboss.org/browse/JBLOGGING-56
I tried the workaround that they mention, but couldn't get it to work either. Unfortunately, new logging framework in JBoss AS 6 seems to be very buggy and undocumented at this moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With