Comprehensive Logging In Julia

02 May 2015

I started a new project Log4jl.
For a long time a was dissatisfied with logging functionality in Julia.
Build-in functions (info, warn & error) are very poor way to log a diverse
collection of events.
I tried some packages, the best so far Logging.jl,
but non of them would be able to provide a flexible way to output my data.

And then, for my research project I had to analyze internals of some algorithm
that creates multitude of data while working. So I wrote my own small logger for this project. Then, I need along with some diagnostic messaging, dump some internal statistics
and states of the algorithm. That was the end of it, I could have write a lot of
diagnostic & logging code inside algorithm, and eventually I have to remove it, or
at least disable, for a final version of the software. So, I decided to spend some
time and write comprehensive logging library.

I perfect logging framework should be able to

Create and configure multiple loggers That is very important, one package has its own logger and configuration, another has its own. If there is only one logger exists, then we have a big problem as soon as we start messing with the logger configuration. So independent configurable loggers are the first priority.

Log messages with accordance to their priority level This is obvious, you need more information, you tune the level of message output.

Save logs in various locations depending on event & message Eventually, you want to log different messages (or maybe objects) differently: text to a screen and a plain text file, program states, as binary dumps, together or separately into binary files. Plus, everything should be marker consistently.

Create custom formatted output A message output format should be configurable and include some system state information.

Easy independent logger configuration Separate from the code, independent for every logger but with description of global parameters, configuration is important part of any logging framework.

Provide definition of custom priority levels Sometimes, you need a special event, like dump of the state, and it would be nice to define special custom low priority level that would do that.

I immediately recalled log4j project that I used many times. And that, how the Log4jl is started.
Of course, I would not be able to provide all functionality of log4j and it is not necessary.
I focus on above topics first and will adopt along the development.