When you want to write some log information from your Jobs, the official Talend recommendation is to use the
tLogRow component, or the curiously-named
tWarn component with a
tLogCatcher. But where do these logs go when you’ve installed Talend Runtime as a service?
You’ve deployed some Jobs that have a bunch of
tLogRow components and you want to see the output. Or you know your job is failing for some reason but you can’t find the stack trace anywhere.
You scour the
tesb.log file but your logs are nowhere to be seen. Debugging becomes very difficult.
So where are the logs?!
Problem: tLogRows and stack traces go to the console
The problem is that much of Talend Job output is blindly directed straight to the console (via Java’s
stderr). This isn’t very helpful as it means all sorts of useful information - everything from internal logs to stack traces from exceptions - is spewed out to the console. And it’s not easy to redirect this output anywhere else.
It’s acceptable when running Jobs and Routes from Talend Studio, as you can see the output appear in the Console window.
But where do these logs go when you deploy to a Talend Runtime server that’s running as a background service? It’s a mystery.
Introducing the wrapper.log file
The answer is due to the way Talend runs. When Talend Runtime is installed as a service, it is run using the Java Service Wrapper.
The wrapper handles the startup and shutdown of the Karaf container (a.k.a. Talend Runtime).
But it also captures the console output from Karaf that would usually be seen on screen and sends it to a log (awesome).
This log can be found in your Karaf container directory, usually called
wrapper.log - e.g.
You can customise this log file by modifying the wrapper config file - where you can set log rotations, max sizes, filenames and so on. All the settings are in
container/etc/karaf-wrapper.conf. Restart Talend Runtime to see the changes take effect.
System.out.println()logs are fine when running in Studio, or when running Talend Runtime as a foreground process
- But when running Talend as a service, console output is captured by the Java Service Wrapper
- This output, including logs and errors, is captured into
wrapper.log, within the Karaf container folder
- For bonus points, hook this file up to Elasticsearch, Logstash and Kibana to become a true logmaster
What do you think? You can use Markdown in your comment.
To write code, indent each line with 4 spaces. Or, to paste a lot of code, you can put it in pastebin.com and share the link in your comment.