簡體   English   中英

如何使用wildfly-swarm為我的應用程序啟用訪問日志?

[英]how can i enable access-log for my application with wildfly-swarm?

我用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);

[...]

其他任何技巧,如jboss-web.xml一樣,是xml?

在此先感謝與最誠摯的問候

訪問日志在Undertow中配置。 您需要使用UndertowFraction啟用它。 就像是

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM