How to create logging handler that redirects all logs from my application to different location
as.tomar1988 Jul 31, 2012 10:12 AMI am using slf4j logging. I cannot redirect all my company logs to different location while using EAP 6, when i configure EAP 6 by creating a new periodic rotating file handler(say EXTERNAL_LOG) and i set the relative path to other location through CLI like
"-Djboss.server.log.dir = c:\Logs", the server.log also goes in that directory which is expected so when i create another property (say jboss.formyapp.log.dir) and edit the details for EXTERNAL_LOG like this:
-->Before creating another property:
<periodic-rotating-file-handler name="EXTERNAL_LOG" autoflush="false">
<level name="DEBUG"/>
<file relative-to="jboss.server.log.dir" path="external.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
-->After creating another property I change the configuration:
<periodic-rotating-file-handler name="EXTERNAL_LOG" autoflush="false">
<level name="DEBUG"/>
<file relative-to="jboss.formyapp.log.dir" path="external.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
and in CLI i give the value to this property as:
"-Djboss.formyapp.log.dir = c:\Logs"
and then if i run JBOSS EAP6 it gives me error
ERROR [org.jboss.msc.service.fail] MSC000001: Failed to start service jboss.logging.handler-file.EXTERNAL_LOG: org.jboss.msc.service.StartException in service jboss.loggin
g.handler-file.EXTERNAL_LOG: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: java.lang.IllegalArgumentException: JBAS014847: Could not find a path called 'external.log'
at org.jboss.as.controller.services.path.PathManagerService.resolveRelativePathEntry(PathManagerService.java:88)
at org.jboss.as.logging.handlers.file.HandlerFileService.start(HandlerFileService.java:52)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
... 3 more
So where am i going worng or is there any other alternative of keeping these log files in two different locations(server.log under /standalone/log and external.log under any other directory) ????