Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Ce contenu n'est pas disponible dans la langue sélectionnée.
16.2. Logging Configuration
Overview Copier lienLien copié sur presse-papiers!
etc/system.properties
—the configuration file that sets the logging level during the container’s boot process. The file contains a single property, org.ops4j.pax.logging.DefaultServiceLog.level, that is set toERROR
by default.org.ops4j.pax.logging
—the PID used to configure the logging back end service. It sets the logging levels for all of the defined loggers and defines the appenders used to generate log output. It uses standard Log4j configuration. By default, it sets the root logger's level toINFO
and defines two appenders: one for the console and one for the log file.NoteThe console's appender is disabled by default. To enable it, addlog4j.appender.stdout.append=true
to the configuration For example, to enable the console appender in a standalone container, you would use the following commands:JBossFuse:karaf@root> config:edit org.ops4j.pax.logging JBossFuse:karaf@root> config:propappend log4j.appender.stdout.append true JBossFuse:karaf@root> config:update
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging JBossFuse:karaf@root> config:propappend log4j.appender.stdout.append true JBossFuse:karaf@root> config:update
Copy to Clipboard Copied! Toggle word wrap Toggle overflow org.apache.karaf.log.cfg
—configures the output of the log console commands.
Changing the log levels Copier lienLien copié sur presse-papiers!
org.ops4j.pax.logging
PID's log4j.rootLogger
property so that the logging level is one of the following:
TRACE
DEBUG
INFO
WARN
ERROR
FATAL
NONE
Example 16.1. Changing Logging Levels
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging JBossFuse:karaf@root> config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender" JBossFuse:karaf@root> config:update
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging
JBossFuse:karaf@root> config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender"
JBossFuse:karaf@root> config:update
Changing the appenders' thresholds Copier lienLien copié sur presse-papiers!
log4j.appender.appenderName.threshold
property that controls what level of messages are written to the appender. The appender threshold values are the same as the log level values.
DEBUG
but limiting the information displayed on the console to WARN
.
Example 16.2. Changing the Log Information Displayed on the Console
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging JBossFuse:karaf@root> config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender" JBossFuse:karaf@root> config:propappend log4j.appender.stdout.threshold WARN JBossFuse:karaf@root> config:update
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging
JBossFuse:karaf@root> config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender"
JBossFuse:karaf@root> config:propappend log4j.appender.stdout.threshold WARN
JBossFuse:karaf@root> config:update
Logging per bundle Copier lienLien copié sur presse-papiers!
sift
appender to the Log4j root logger as shown in Example 16.3, “Enabling Per Bundle Logging”.
Example 16.3. Enabling Per Bundle Logging
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging JBossFuse:karaf@root> config:propset log4j.rootLogger "INFO, out, sift, osgi:VmLogAppender" JBossFuse:karaf@root> config:update
JBossFuse:karaf@root> config:edit org.ops4j.pax.logging
JBossFuse:karaf@root> config:propset log4j.rootLogger "INFO, out, sift, osgi:VmLogAppender"
JBossFuse:karaf@root> config:update
data/log/BundleName.log
.
org.ops4j.pax.logging.cfg
.
Logging History Copier lienLien copié sur presse-papiers!
~/.karaf/karaf.history
. JBoss Fuse can be configured to prevent the history from being saved each time.
Procedure 16.1. Stop JBoss Fuse saving Logging History on shutdown.
- Stop JBoss Fuse.
- Edit
$FUSE_HOME/etc/system.properties
. - Uncomment the line that says
# karaf.shell.history.maxSize = 0
. - Restart JBoss Fuse
~/.karaf/karaf.history
will still be created, but it will always have a size of 0, and will be empty.