
Anonymous
Not applicable
2012-06-25
06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sl4j or log4j logging
Hi,
I tried configuring loggers in one of the pax.logging.cfg file, java.util.logging.properties files as below-
log4j.logger.com.mypackage.MyApp=DEBUG, out, stdout
in talend route java code-
org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(MyApp.class);
log.warn("sample log message");
the above statement does not log at any level ( WARN, DEBUG). Any idea? I get no logging errors as well
Also tried installing tlog4j and tlogcatcher components but, they found to be not available in Mediation view.
513 Views
8 Replies

Anonymous
Not applicable
2012-06-25
07:04 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you test inside the Talend Runtime (OSGi) or outside? Inside the Talend Runtime it should just work. You should not even need to adjust the logging config as you are using .warn which should always be logged.
513 Views

Anonymous
Not applicable
2012-06-25
07:56 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested inside osgi container. I can see that loggers are working if implemented by -
org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(MyApp.class);
if(log.isWarnEnabled())
log.warn("sample log message");
but, I want it with org.slf4j.Logger as I am using some talend components that implement the logger this way. Are there any jars I am missing?
I already put sl4j-api-1.6.1, sl4j-log4j-1.6.1, common-logging.jar, log4j-1.2.16.jar in cconfig.
I also tried without configuring the properties and without jars. This way, sl4j is defaulting to NOP implementation.
org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(MyApp.class);
if(log.isWarnEnabled())
log.warn("sample log message");
but, I want it with org.slf4j.Logger as I am using some talend components that implement the logger this way. Are there any jars I am missing?
I already put sl4j-api-1.6.1, sl4j-log4j-1.6.1, common-logging.jar, log4j-1.2.16.jar in cconfig.
I also tried without configuring the properties and without jars. This way, sl4j is defaulting to NOP implementation.
513 Views

Anonymous
Not applicable
2012-06-25
08:44 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem may be exactly that you put the slf4j api in the config. As far as I know that means it is embedded into the jar. Probably that makes the slf4j invisble for pax logging. You can check the resulting jar of your route. It should not embed slf4j api and instead have an Import-Package for it.
513 Views

Anonymous
Not applicable
2012-06-25
10:27 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I make slf4j api as Import-Package ? I am using Talend. The reference is not present in Import-Package.
513 Views

Anonymous
Not applicable
2012-06-25
11:09 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also saw that. I checked with the the dev team for the tooling. Currently it does not seem to be possible to use slf4j.
They are working on a solution. I hope we can at least add the import package statements to the manifest for the next bugfix release. For the longer term it is planned to allow users to specify their own imports.
They are working on a solution. I hope we can at least add the import package statements to the manifest for the next bugfix release. For the longer term it is planned to allow users to specify their own imports.
513 Views

Anonymous
Not applicable
2012-06-27
02:20 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might try to use the Advanced tab on the cMessageEndpoint rather than the cConfig. The behavior for exporting dependencies is slightly different than with cConfig.
513 Views

Anonymous
Not applicable
2012-06-27
02:57 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hmm, I don't seem to have any problem using slf4j within a cbean in 5.1.1. I assume the same would be true using routes developed with beans that were developed in Eclipse and imported into a Talend project I've attached links to a sample route (very trivial) that uses sl4j with log4j. It runs it both Studio and ESB runtime without problems. Perhaps I am misunderstanding the problem?
Here is the exported route http://eost.net/eost/slf4jTest/slf4jTest.zip
Here is the exported route http://eost.net/eost/slf4jTest/slf4jTest.zip
513 Views

Anonymous
Not applicable
2014-02-06
03:47 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where is the log4J configuration in Talend 5.4.1 Studio? It used to be in Preferences -> Talend -> Run/Debug -> Log4j in 5.2.2 now it's gone. I don't understand why Talend removes features and then not document the change.
513 Views
