Monday, 18 November 2013

DOTS: Logging to server console and log.nsf

In one of my current development projects I am developing a DOTS server task(let). One thing that I found very annoying is the logging part of DOTS. With logging, I essentially mean - at least in this post - an output to the server console and / or log.nsf. To achieve this, there are basically two different possibilities for logging in your DOTS projects.

Option 1:  System.out.println
As in other Java projects you can use System.out.println("your message") to print out message to the server console.
Running this little tasklet results in the following output on the server's console:

As you can see, the message is printed to the console. What you cannot see from here is that these messages are not save to log.nsf.

Option 2: logMessage
A way better logging is provided by a specific method logMessage("your message") which is part of the class
While your cord  resides inside the tasklet you can easily use this method instantly without any further declarations:
The output looks like that:

Using this method has several benefits:
  • Messages logged using the logMessage method are saved to log.nsf. 
  • You can see the date and time of the message.
  • In addition, the message indicates that it comes from the DOTS Tasklet "Helloworld".
In my opinion this is the clean way to go for logging from a DOTS tasklet to the console respectively log.nsf.

Moreover, the ServerConsole class provides another very useful method "logException" which accepts a throwable Java Exception which then will be printed to the console. In other words: you can use this method in any catch statemen to handle error logging to the server console / log.nsf.


  1. I think it's worth to say that logMessage("") only works directly in the Tasklet class. If you want to log outside of that class you can use ServerTaskManager.getInstance().logMessageText("").

    In addition I highly recommend to look at log4j2 ( It works like a charm in combination with DOTS and you'll see big performance gains against NSF based logging.

    1. Hi Rene,

      thanks for your feedback. I was going to update the post to include some info about logging outside the ServerTask today. I was not aware of the ServerTaskManager.getInstance().logMessageText() which is really straightforward to use. And logging into my own log file is another thing worth looking into. Thanks for letting me know, I will definately add this to the post!

  2. I have developed a very simple class using ServerConsole in CollaborationToday - FeedMonster.

    It extends the Logger class:

    You can see how I used it here:

    1. Cool stuff. Thanks, Serdar. I will be looking into this, too :)

  3. Specify any necessities for particular cut-to-size pieces, margin or edge remedies, finishing, leveling, fabrication, non-standard tolerances, and so on. If your project calls for Infill Panels, an Infill Panel Worksheet is available in the Overview section on the Perforated Metal Resources landing web page. The waste material might be generated during the expansion of the manufacturing course of, saving lots of material costs. Moreover, the expanded sheet is lighter in weight and stronger in structure than the original sheet. As a extremely versatile metallic, aluminum sheet is utilized in a vast array of applications in numerous industries. The applications to which this form of aluminum is utilized Hand Held Massager vary from small and sensitive to massive scale.


Comment Form Message