Reputation: 71
I am currently evaluating an app migration to Bluemix. It currently uses the log4j properties to write different type of errors in different Application specific Log files. What are the options in Bluemix for the same, since I understand writing to files is not supported? What if I need similar application behaviour with minimal config /code change? Sample config :
<appender name="info-out"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="filelocn/apps/logs/MyAppOnline-Info.log"/>
Upvotes: 1
Views: 321
Reputation: 147
When looking at log drains, make sure you test the output. We're using java.util.logging with Kibana 4 and it does not handle multi-line or stacktraces well (or at all).
Upvotes: 0
Reputation: 3233
You could actually write on files, but it is something that should be avoided because of the Cloud Foundry nature, as you can see here Considerations for Designing and Running an Application in the Cloud.
Usually to log in Bluemix Java applications you have to log to STDOUT and have loggregator drain the logs. You then can retrieve them using cf logs appName --recent.
Another option is to use the IBM Monitoring and Analytics service. This add-on service will collect and persist log entries written by your Java application to standard Liberty runtime logs such as messages.log or trace.log. The Add-On collects and persists log entries and allows you to search and plot results graphically. The Add-On combines log analysis with availability and performance monitoring of your application. See Monitoring and Analytics - Log Analysis tab.
As a third option you could use a third party tool (take a look here).
Unfortunately none of the above options allow to create different files. If you really need to keep that kind of separation you could think to implement a DB logging system using log4j DB appender. Take a look here for some useful pointers.
Upvotes: 1