2016-11-22 49 views
0

我已经创建了一个具有wildfly-swarm的RestApplication。应用程序日志与log4j2一起工作良好。但我不知道,我怎样才能为我的应用程序启用访问日志。我怎样才能为我的应用程序使用野蝇群访问日志?

我不能使用带阀门的jboss-web.xml,因为它不会被支持!我知道,我可以创建群编程喜欢:

ClassLoader cl = Main.class.getClassLoader(); 
URL xmlConfig = cl.getResource("standalone.xml"); 

Swarm swarm = new Swarm(false) 
     .withXmlConfig(xmlConfig); 

[...] 

任何其他的窍门,声明XML像JBoss-web.xml中?

在此先感谢&最诚挚的问候

回答

0

访问日志是暗潮配置。您需要使用​​才能启用它。像

final UndertowFraction fraction = UndertowFraction.createDefaultFraction(); 
fraction.subresources() 
     .server("default-server") 
     .subresources() 
     .host("default-host") 
     .accessLogSetting(new AccessLogSetting().useServerLog(true)); 
+0

东西也许我们可以提供一种方法,使通过配置? – Ken

+0

感谢您的回答。我会用它,如果我找不到其他声明方式。 – shan