Using JBoss Fuse / Apache Camel, writing to log file configured in org.ops4j.pax.logging.properties
, I would like to log the host name.
log4j.appender.myapp.layout.ConversionPattern=${host} %d{ISO8601} %p %X{bundle.id} %c{1} %m%n
The part in the converstion pattern ${host}
doesn't work.
Is there a way I can get this? Is there something like %X{host.name}
?
In the code I read about HOSTNAMENONCANON
- perhaps can I access that?
The log framework is OPS4j
, and whilst the patterns look similar to log4j, I am not sure if they work in the same way, or indeed if a way to log the host name via log4j would also work here (but it might be worth a try).
Thanks, VikingSteve.
I found that you can use %X{hostname}
if you configure this via the MDC
static method:
MDC.put("hostname", xyz);
I'm not sure if this is the best solution? It seems fine to me (?).