我在openshift v3上使用JBOSS 6.4 EAP。我能够在控制台上查看应用程序日志,但无法将它们输出到文件。我正在尝试使用periodic-rotating-file-handler。下面是我的standalone-openshift.xml配置:
<subsystem xmlns="urn:jboss:domain:logging:1.5">
<console-handler name="CONSOLE">
<formatter>
<named-formatter name="OPENSHIFT"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<async-handler name="ASYNC">
<queue-length value="512"/>
<overflow-action value="block"/>
<subhandlers>
<handler name="CONSOLE"/>
</subhandlers>
</async-handler>
<async-handler name="FILEASYNC">
<queue-length value="512"/>
<overflow-action value="block"/>
<subhandlers>
<handler name="FILE"/>
</subhandlers>
</async-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>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="ASYNC"/>
<handler name="FILEASYNC"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<formatter name="OPENSHIFT">
<custom-formatter module="org.jboss.logmanager.ext" class="org.jboss.logmanager.ext.formatters.LogstashFormatter"/>
</formatter>
</subsystem>
想知道是否有人遇到类似的问题而且知道我做错了什么?我能够看到服务器启动日志,但文件上没有应用程序日志。
答案 0 :(得分:0)
您的格式化名称=&#34; PATTERN&#34;已在/opt/eap/standalone/configuration/logging.properties
这是一个适合我的配置:
<subsystem xmlns="urn:jboss:domain:logging:1.5">
<console-handler name="CONSOLE">
<formatter>
<named-formatter name="COLOR-PATTERN" />
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="COLOR-PATTERN" />
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log" />
<suffix value=".yyyy-MM-dd" />
<append value="true" />
</periodic-rotating-file-handler>
<async-handler name="ASYNC">
<queue-length value="512" />
<overflow-action value="block" />
<subhandlers>
<handler name="CONSOLE" />
</subhandlers>
</async-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>
<root-logger>
<level name="INFO" />
<handlers>
<handler name="ASYNC" />
<handler name="FILE" />
</handlers>
</root-logger>
<formatter name="OPENSHIFT">
<custom-formatter module="org.jboss.logmanager.ext" class="org.jboss.logmanager.ext.formatters.LogstashFormatter">
<properties>
<property name="metaData" value="log-handler=CONSOLE" />
</properties>
</custom-formatter>
</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
:
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