ConfD User Community

Redirect application log to devel.log file

I would like to redirect my confd application logs to devel.log.So that based on confd debug level logs will get stored in devel.log.Also which macro I should use if CONFD_DEBUG/CONFD_TRACE is enabled.


Two common Linux examples:
my_app_printing_logs_to_stderr 2> devel.log &
or (since we like tail -f)
tail -F my_app.log devel.log &

See this post on the topic of printing the application log to a file: Confd_trace log file

I would prefer CONFD_TRACE for debugging my application and CONFD_DEBUG when deploying

In case you need to use logging and do not require logs are in devel.log, for C applications you can also use logging framework that is part of examples. See examples.confd/logging_framework

In the existing devel.log only, i would like to redirect my application log into that.
So for that do I need to use any specific API instead of using of printf .


If you are using the Erlang ConfD API and your application is running inside ConfD, you can use econfd:log/2,3,4; otherwise, there is no API that would allow you to send your logs into devel.log.

Just fprintf() to a file that you open similar to the link I provided. Then use one of the two Linux examples I explained-