web access logs to syslog (in wildfly 8.2)
matt.drees Apr 14, 2015 2:23 PMThe basic question is: "How can I configure wildfly 8.2 to send http access log lines to a syslog listener, instead of to a file?"
Background:
I'm docker-izing an app, and wildfly-ifying it at the same time. I'd like to use the syslog approach for logging, at least for my first attempt. The logging subsystem has a syslog appender, so this works fine for 'normal' logs.
Problem:
Wildfly/Undertow's http access logs, however, don't seem to use the logging subsystem. If I'm reading it right, the configuration only allows for creating a DefaultAccessLogReceiver. What I'd actually like is to configure a JBossLoggingAccessLogReceiver, which presumably *would* use the logging subsystem.
Failed workaround:
Since wildfly allows attaching extra HttpHandlers, I thought I'd just attach an AccessLogHandler this way. But it doesn't have the appropriate constructor, and the resulting stacktrace looks like this:
17:57:50,090 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-13) MSC000001: Failed to start service jboss.undertow.server.default-server.default-host: org.jboss.msc.service.StartException in service jboss.undertow.server.default-server.default-host: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] ... at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65] Caused by: java.lang.RuntimeException: JBAS017351: Failed to configure handler class io.undertow.server.handlers.accesslog.AccessLogHandler at org.wildfly.extension.undertow.deployment.ConfiguredHandlerWrapper.wrap(ConfiguredHandlerWrapper.java:78) at org.wildfly.extension.undertow.filters.CustomFilterDefinition.createHttpHandler(CustomFilterDefinition.java:100) at org.wildfly.extension.undertow.filters.FilterService.createHttpHandler(FilterService.java:57) at org.wildfly.extension.undertow.filters.FilterRef.createHttpHandler(FilterRef.java:50) at org.wildfly.extension.undertow.LocationService.configureHandlerChain(LocationService.java:100) at org.wildfly.extension.undertow.Host.configureRootHandler(Host.java:105) at org.wildfly.extension.undertow.Host.start(Host.java:83) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] ... 3 more Caused by: java.lang.NoSuchMethodException: io.undertow.server.handlers.accesslog.AccessLogHandler.<init>(io.undertow.server.HttpHandler) at java.lang.Class.getConstructor0(Class.java:2849) [rt.jar:1.7.0_65] at java.lang.Class.getConstructor(Class.java:1718) [rt.jar:1.7.0_65] at org.wildfly.extension.undertow.deployment.ConfiguredHandlerWrapper.wrap(ConfiguredHandlerWrapper.java:55) ... 11 more
So, if I'm reading it right, I'm out of luck. Am I missing something?
Also, it seems like this could be fixed easily enough, perhaps by adding a 'target=logging-subsystem' attribute to <access-log>. There are probably other ways too. I might be up for working on a pull request, if someone would be willing to give me some direction.