Skip to content

Commit

Permalink
Added new method to write log messages to the server console
Browse files Browse the repository at this point in the history
  • Loading branch information
klehmann committed Oct 19, 2022
1 parent 9224573 commit a6fdea5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -881,4 +881,6 @@ short NAMEGetAddressBooks(

void OSLocalFree (Pointer ptr);

void AddInLogMessageText(Memory string, short AdditionalErrorCode, Object... args);

}
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,27 @@ public static void verifyPassword(String pwd, String digest) {
digestLen, digestMem, 0, null);
NotesErrorUtils.checkResult(result);
}

/**
* Format and write a message to the log file. <br>
* <br>
* This function formats a message, displays it on the standard output, and appends the message as
* new line to the "Events" field in a Miscellaneous Events document in the Domino server or Notes client log.<br>
* <br>
* The generated message has the form:<br>
* <br>
* <code>&lt;DATE&gt; &lt;TIME&gt; &lt;Primary status message&gt;</code><br>
* <br>
* Using this method instead of a simple <code>System.out.println()</code> has the benefit that
* the message will be directly visible on the server console, while in other cases Domino might
* buffer the messages written by Java (e.g. when an OSGi command is registered via the Eclipse
* CommandInterpreter) until Java execution is done.
*
* @param messageText message text
*/
public static void addInLogMessage(String messageText) {
Memory lmbcs = NotesStringUtils.toLMBCS(messageText, true);
NotesNativeAPI.get().AddInLogMessageText(lmbcs, (short)0, new Object[0]);
}

}

0 comments on commit a6fdea5

Please sign in to comment.