gpt4 book ai didi

java - 无法阻止 Wildfly 创建日志文件

转载 作者:行者123 更新时间:2023-12-01 23:04:28 26 4
gpt4 key购买 nike

即使我从standalone.xml 中删除了文件记录器,Wildfy 仍不断创建日志文件Wildfly在docker中运行,不知道与问题是否相关...

下面是我的独立日志子系统:

        <console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="JsonFormatter"/>
</formatter>
</console-handler>
<custom-handler name="SENTRY" class="someClassName" module="moduleName">
<level name="ERROR"/>
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<filter-spec value="not(match(&quot;(duplicate key value violates unique constraint)\\s.(idx_segment_uuid|idx_passenger_uuid|idx_item_uuid|pk_booking_number_lookup)&quot;))"/>
</custom-handler>
<file-handler name="AUDITREADFILE" autoflush="true">
<formatter>
<named-formatter name="AUDITPATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="audit_read.log"/>
<append value="true"/>
</file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="jacorb">
<level name="WARN"/>
</logger>
<logger category="jacorb.config">
<level name="ERROR"/>
</logger>
<logger category="org.hibernate.SQL">
<level name="INFO"/>
</logger>
<logger category="com.hazelcast">
<level name="WARN"/>
</logger>
<logger category="someClassName">
<level name="INFO"/>
handlers>
<handler name="SENTRY"/>
</handlers>
</logger>
<logger category="someClassName">
<level name="ERROR"/>
</logger>
<logger category="someClassName">
<level name="ERROR"/>
</logger>
<logger category="com.vsct.oce.services">
<level name="DEBUG"/>
</logger>
<logger category="audit.read" use-parent-handlers="false">
<level name="INFO"/>
<handlers>
<handler name="AUDITREADFILE"/>
</handlers>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
</handlers>
</root-logger>
<formatter name="JsonFormatter">
<custom-formatter module="moduleName" class="someClassName">
<properties>
<property name="version" value="1.0" />
<property name="facility" value="java-test" />
<property name="fields" value="Time,Severity,ThreadName,SourceClassName,SourceMethodName,SourceSimpleClassName,LoggerName,NDC" />
<property name="extractStackTrace" value="true" />
<property name="filterStackTrace" value="true" />
<property name="mdcProfiling" value="true" />
<property name="timestampPattern" value="yyyy-MM-dd'T'HH:mm:ss.SSSZ" />
<property name="mdcFields" value="Time,Severity,ThreadName,SourceClassName,SourceMethodName,SourceSimpleClassName,LoggerName,NDC" />
<property name="dynamicMdcFields" value="mdc.*,(mdc|MDC)fields" />
<property name="includeFullMdc" value="true" />
</properties>
</custom-formatter>
</formatter>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
<formatter name="AUDITPATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss} %s%e%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
</subsystem>

生成的logging.properties:


# logging subsystem has been defined in the XML configuration.





# Additional loggers to configure (the root logger is always configured)

loggers=org.hibernate.SQL,audit.read,com.arjuna,com.company,com.company.className,com.hazelcast,com.vsct.oce.services,com.company.someClassName,sun.rmi,jacorb,org.jboss.as.config,jacorb.config,org.apache.tomcat.util.modeler



logger.level=INFO

logger.handlers=CONSOLE



logger.org.hibernate.SQL.level=INFO

logger.org.hibernate.SQL.useParentHandlers=true



logger.audit.read.level=INFO

logger.audit.read.useParentHandlers=false

logger.audit.read.handlers=AUDITREADFILE



logger.com.arjuna.level=WARN

logger.com.arjuna.useParentHandlers=true



logger.com.company.level=INFO

logger.com.company.useParentHandlers=true

logger.com.company.handlers=SENTRY



logger.com.company.someClassName.level=ERROR

logger.com.company.someClassName.useParentHandlers=true



logger.com.hazelcast.level=WARN

logger.com.hazelcast.useParentHandlers=true



logger.com.vsct.oce.services.level=DEBUG

logger.com.vsct.oce.services.useParentHandlers=true



logger.com.company.someClassName.level=ERROR

logger.com.company.someClassName.useParentHandlers=true



logger.sun.rmi.level=WARN

logger.sun.rmi.useParentHandlers=true



logger.jacorb.level=WARN

logger.jacorb.useParentHandlers=true



logger.org.jboss.as.config.level=DEBUG

logger.org.jboss.as.config.useParentHandlers=true



logger.jacorb.config.level=ERROR

logger.jacorb.config.useParentHandlers=true



logger.org.apache.tomcat.util.modeler.level=WARN

logger.org.apache.tomcat.util.modeler.useParentHandlers=true



handler.AUDITREADFILE=org.jboss.logmanager.handlers.FileHandler

handler.AUDITREADFILE.level=ALL

handler.AUDITREADFILE.formatter=AUDITPATTERN

handler.AUDITREADFILE.properties=append,autoFlush,enabled,fileName

handler.AUDITREADFILE.append=true

handler.AUDITREADFILE.autoFlush=true

handler.AUDITREADFILE.enabled=true

handler.AUDITREADFILE.fileName=/opt/jboss/wildfly/standalone/log/audit_read.log



handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler

handler.CONSOLE.level=INFO

handler.CONSOLE.formatter=JsonFormatter

handler.CONSOLE.properties=autoFlush,target,enabled

handler.CONSOLE.autoFlush=true

handler.CONSOLE.target=SYSTEM_OUT

handler.CONSOLE.enabled=true



handler.SENTRY=com.company.someClassName

handler.SENTRY.module=com.company.module

handler.SENTRY.level=ERROR

handler.SENTRY.filter=not(match("(duplicate key value violates unique constraint)\\\\s.(idx_segment_uuid|idx_passenger_uuid|idx_item_uuid|pk_booking_number_lookup)"))

handler.SENTRY.formatter=PATTERN



# Additional formatters to configure

formatters=COLOR-PATTERN





formatter.JsonFormatter=com.company.someClassName

formatter.JsonFormatter.module=com.company.module

formatter.JsonFormatter.properties=version,facility,fields,extractStackTrace,filterStackTrace,mdcProfiling,timestampPattern,mdcFields,dynamicMdcFields,includeFullMdc

formatter.JsonFormatter.version=1.0

formatter.JsonFormatter.facility=java-test

formatter.JsonFormatter.fields=Time,Severity,ThreadName,SourceClassName,SourceMethodName,SourceSimpleClassName,LoggerName,NDC

formatter.JsonFormatter.extractStackTrace=true

formatter.JsonFormatter.filterStackTrace=true

formatter.JsonFormatter.mdcProfiling=true

formatter.JsonFormatter.timestampPattern=yyyy-MM-dd'T'HH\:mm\:ss.SSSZ

formatter.JsonFormatter.mdcFields=Time,Severity,ThreadName,SourceClassName,SourceMethodName,SourceSimpleClassName,LoggerName,NDC

formatter.JsonFormatter.dynamicMdcFields=mdc.*,(mdc|MDC)fields

formatter.JsonFormatter.includeFullMdc=true



formatter.AUDITPATTERN=org.jboss.logmanager.formatters.PatternFormatter

formatter.AUDITPATTERN.properties=pattern

formatter.AUDITPATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss} %s%e%n



formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter

formatter.PATTERN.properties=pattern

formatter.PATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n



formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter

formatter.COLOR-PATTERN.properties=pattern

formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n

使用上述配置,仍然会生成 server.log 文件。但它只包含主要来自 org.jboss 和 org.wildfly 类的前几百行。

知道为什么每次启动时仍然生成 server.log 文件吗?

最佳答案

事实证明,docker 镜像内部的logging.properties 正在启动并生成文件,直到根据standalone.xml 对其进行修改。感谢 James R. Perkins'提示我能够弄清楚。一旦我将没有文件处理程序的默认logging.properties文件添加到图像中,问题就解决了。

关于java - 无法阻止 Wildfly 创建日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58408557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com