[
https://issues.apache.org/jira/browse/CAMEL-6694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13956278#comment-13956278
]
Grzegorz Grzybek commented on CAMEL-6694:
-----------------------------------------
I did simple trick with user provided logger instance when creating route.
Here's sample pax-exam test:
{code:java}
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
registry.bind("mylogger",
LoggerFactory.getLogger("org.apache.camel.SIFT"));
return registry;
}
...
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
camelContext.setUseMDCLogging(true);
return camelContext;
}
...
@Test
public void testSendMessageToInfoLogWithSiftLogging() throws Exception {
template.sendBody("log:org.apache.camel.SIFT?level=info&logger=#mylogger",
"<level>INFO</level>");
template.sendBody("log:org.apache.camel.SIFT?level=debug&logger=#mylogger",
"<level>DEBUG</level>");
template.sendBody("log:org.apache.camel.SIFT?level=info&logger=#mylogger",
"<level>INFO</level>");
template.sendBody("log:org.apache.camel.SIFT?level=error&logger=#mylogger",
"<level>ERROR</level>");
}
{code}
and the log is correctly produced in
{{KARAF_BASE/data/log/PAXEXAM-PROBE-143533e1-9f41-4734-ba6c-ab1f1e417fd8.log}}.
The only thing that I don't like is that the *org.apache.camel.SIFT* part in
endpoint URI isn't actually used. Do you have an idea how to make it cleaner?
> Make Log component and EIP compatible with log4j MDC Sift Appender
> ------------------------------------------------------------------
>
> Key: CAMEL-6694
> URL: https://issues.apache.org/jira/browse/CAMEL-6694
> Project: Camel
> Issue Type: Bug
> Affects Versions: 2.12.0
> Reporter: Raúl Kripalani
> Assignee: Grzegorz Grzybek
> Fix For: 2.13.1
>
>
> Refer to
> http://camel.465427.n5.nabble.com/Logging-into-the-bundle-log-file-via-to-log-tp5738205p5738413.html
> for more info.
> We should use the Camel Context's Classloader to initialize the Logger
> instance.
--
This message was sent by Atlassian JIRA
(v6.2#6252)