Search code examples
jbosswildflydcm4che

How to change the server.log to write to the console in JBoss Wildfly (dcm4chee)


We are using the dcm4chee docker container (dcm4che/dcm4chee-arc-psql:5.31.3) that is using a JBoss Wildfly. Now we like to have the content of the file /opt/wildfly/standalone/log/server.log in the console. This way we do not loose the content when the POD does a restart.

I tried to overwrite the /opt/wildfly/standalone/configuration/logging.properties, but this file is generated when the server starts. See also bootup logging

I could not find a setting in https://github.com/dcm4che-dockerfiles/dcm4chee-arc-psql/blob/master/README.md

Here is the general documentation from JBoss: general_docu

and here the section about the console link but I can not make sense out of it, as it looks for me, you configure the JBoss with a CLI and i do not see how to do it in a docker container.

Thanks for your help T

Update after comment from ehsavoie I checkout the file standalone.xml When i look that the current configuration (see below) it would log all Level "info" to console + file. but it does not. The actual Logoutput is different for file and console. @ehsavoie did i miss something? enter image description here

    <profile>
        <subsystem xmlns="urn:jboss:domain:logging:8.0">
            <console-handler name="CONSOLE">
                <level name="INFO"/>
                <formatter>
                    <named-formatter name="COLOR-PATTERN"/>
                </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>
            <logger category="com.arjuna">
                <level name="WARN"/>
            </logger>
            <logger category="com.networknt.schema">
                <level name="WARN"/>
            </logger>
            <logger category="io.jaegertracing.Configuration">
                <level name="WARN"/>
            </logger>
            <logger category="org.jboss.as.config">
                <level name="DEBUG"/>
            </logger>
            <logger category="sun.rmi">
                <level name="WARN"/>
            </logger>
            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="CONSOLE"/>
                    <handler name="FILE"/>
                </handlers>
            </root-logger>
            <formatter name="PATTERN">
                <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %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>

Update after comment from "James R. Perkins" I am a 100% sure that the logs are not written to the console. I suspect the /opt/wildfly/standalone/configuration/logging.properties to overwrite the config. Note that is file is generated everytime the server starts.

# Note this file has been generated and will be overwritten if a
# logging subsystem has been defined in the XML configuration.


# Additional loggers to configure (the root logger is always configured)
loggers=org.dcm4chee.arc.retrieve,org.dcm4chee.arc,org.hibernate.SQL,org.dcm4che3.net.imageio,org.dcm4che3.util.ReverseDNS,org.dcm4chee.arc.query,org.hibernate.orm.jdbc.bind,com.arjuna,org.dcm4chee.arc.storage,org.dcm4chee.arc.procedure,org.dcm4che3.net.Association,sun.rmi,io.jaegertracing.Configuration,org.jboss.as.config,org.jclouds,org.dcm4che3.net.Dimse,jclouds.headers,org.dcm4che3.net.Timeout

logger.level=INFO
logger.handlers=FILE

logger.org.dcm4chee.arc.retrieve.level=INFO
logger.org.dcm4chee.arc.retrieve.useParentHandlers=true

logger.org.dcm4chee.arc.level=INFO
logger.org.dcm4chee.arc.useParentHandlers=true

logger.org.hibernate.SQL.level=INFO
logger.org.hibernate.SQL.useParentHandlers=true

logger.org.dcm4che3.net.imageio.level=INFO
logger.org.dcm4che3.net.imageio.useParentHandlers=true

logger.org.dcm4che3.util.ReverseDNS.level=INFO
logger.org.dcm4che3.util.ReverseDNS.useParentHandlers=true

logger.org.dcm4chee.arc.query.level=INFO
logger.org.dcm4chee.arc.query.useParentHandlers=true

logger.org.hibernate.orm.jdbc.bind.level=INFO
logger.org.hibernate.orm.jdbc.bind.useParentHandlers=true

logger.com.arjuna.level=WARN
logger.com.arjuna.useParentHandlers=true

logger.org.dcm4chee.arc.storage.level=INFO
logger.org.dcm4chee.arc.storage.useParentHandlers=true

logger.org.dcm4chee.arc.procedure.level=INFO
logger.org.dcm4chee.arc.procedure.useParentHandlers=true

logger.org.dcm4che3.net.Association.level=INFO
logger.org.dcm4che3.net.Association.useParentHandlers=true

logger.sun.rmi.level=WARN
logger.sun.rmi.useParentHandlers=true

logger.io.jaegertracing.Configuration.level=WARN
logger.io.jaegertracing.Configuration.useParentHandlers=true

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

logger.org.jclouds.level=INFO
logger.org.jclouds.useParentHandlers=true

logger.org.dcm4che3.net.Dimse.level=INFO
logger.org.dcm4che3.net.Dimse.useParentHandlers=true

logger.jclouds.headers.level=INFO
logger.jclouds.headers.useParentHandlers=true

logger.org.dcm4che3.net.Timeout.level=INFO
logger.org.dcm4che3.net.Timeout.useParentHandlers=true

handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.FILE.level=ALL
handler.FILE.formatter=PATTERN
handler.FILE.properties=autoFlush,append,fileName,suffix
handler.FILE.constructorProperties=fileName,append
handler.FILE.autoFlush=true
handler.FILE.append=true
handler.FILE.fileName=/opt/wildfly/standalone/log/server.log
handler.FILE.suffix=.yyyy-MM-dd

# Additional formatters to configure
formatters=COLOR-PATTERN


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


Solution

  • I found the solution. For some reason the dcm4chee-arc.xml is used as config. When i change this file, it worked.

    In the docker compose file i added this line

        volumes:
      # change config to so the content of /opt/wildfly/standalone/log/server.log is logged to the console
      - ./arc/dcm4chee-arc.xml:/docker-entrypoint.d/configuration/dcm4chee-arc.xml