Details
Description
ContextMapLookup has been worked fine using escaped
${ctx:xxx}
placeholder in log4j config, but in karaf 4.1.2 it doesn't work anymore.
To replicate the issue, add this properties in etc/org.ops4j.pax.logging.cfg trying to setup a single log file per bundle:
log4j2.appender.bundle.type = Routing log4j2.appender.bundle.name = RoutingByBundle log4j2.appender.bundle.routes.type = Routes log4j2.appender.bundle.routes.pattern = \$\$\\\{ctx:bundle.name\} log4j2.appender.bundle.routes.bundlename.type = Route log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-\$\\\{ctx:bundle.name\} log4j2.appender.bundle.routes.bundlename.appender.fileName = ${karaf.data}/log/karaf.\$\\\{ctx:bundle.name\}-\$\\\{ctx:bundle.id\}.log log4j2.appender.bundle.routes.bundlename.appender.append = true log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t] - %m%n log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
Configuration works, but restarting karaf empty values replace placeholders in config settings, breaking configuration:
log4j2.appender.bundle.type = Routing log4j2.appender.bundle.name = RoutingByBundle log4j2.appender.bundle.routes.type = Routes log4j2.appender.bundle.routes.pattern = $ log4j2.appender.bundle.routes.bundlename.type = Route log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile- log4j2.appender.bundle.routes.bundlename.appender.fileName = /home/rolag/Desktop/apache-karaf-4.1.2/data/log/karaf.-.log log4j2.appender.bundle.routes.bundlename.appender.append = true log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t] - %m%n log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
Attachments
Issue Links
- duplicates
-
KARAF-5326 variables in cfg files are expanded
- Resolved