1
votes

Could anybody say what is the proper way of configuring loggers for Domino REST services? I have studied the code from I have installed "Domino Sample REST Service Feature" from 901v00_11.20141217-1000 version of XPages Extension Library.

As far as I understood logging is done with the help of

import com.ibm.commons.log.Log;
import com.ibm.commons.log.LogMgr;

What I would like to understand is

1) How can I enable the logging and send it to a file and/or console. So far I have enabled logging to console by

LogMgr MyLogMgr = Log.load( "my_rest_service");
java.util.logging.ConsoleHandler CH = new java.util.logging.ConsoleHandler();
MyLogMgr.getLogger().addHandler(CH);

I would very much like to understand how I can do it via a configuration file...

2) To set the logging level and to generate trace entries I used

MyLogMgr.setLogLevel(LogMgr.LOG_TRACEENTRYEXIT_LEVEL);

public ReturnType myFunciton()
{
  MyLogMgr.traceEntry(this, "myFunction");

  // Function body

  MyLogMgr.traceExit(this, "myFunction", functionReturnVariable);
}

What I would like to achieve is one console log handler with one log level, one file log handler with a different log level. Could anybody show me code example of how this could be done?

3) Maybe there is some Domino GUI which allows to set log levels dynamically. If so could anybody share a code sample showing how a Domino Java REST service could "connect" to this GUI...

1

1 Answers

2
votes

To configure the log level, you need to edit a text file called rcpinstall.properties. You can find the file here:

\{dominodata}\domino\workspace\.config\rcpinstall.properties

where {dominodata} is the data directory for your Domino server. The following lines would increase the log level for both the DAS plugin and your REST service:

com.ibm.domino.das.level=FINEST
my_rest_service.level=FINEST

After editing rcpinstall.properties, be sure to restart the HTTP task.

By the way, you can find the log output here:

\{dominodata}\domino\workspace\logs

Usually the log output is a set of XML files (trace-log-0.xml, etc.). However, you can configure different log handlers and formatters. You can probably find details by searching the web.