Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LOGMGR-201] Allow null messages, as other handlers to, to passed to … #200

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,6 @@ public SyslogHandler(final InetAddress serverAddress, final int port, final Faci

@Override
public final void doPublish(final ExtLogRecord record) {
// Don't log empty messages
if (record.getMessage() == null || record.getMessage().isEmpty()) {
return;
}
synchronized (outputLock) {
init();
if (out == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,22 @@ public void testMultibyteTruncation() throws Exception {

}

@Test
public void testNullMessage() throws Exception {
// Setup the handler
handler.setSyslogType(SyslogType.RFC5424);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
handler.setOutputStream(out);

final Calendar cal = getCalendar();
// Create the record
handler.setHostname("test");
ExtLogRecord record = createRecord(cal, null);
final String expectedMessage = "<14>1 2012-01-09T04:39:22.000" + calculateTimeZone(cal) + " test java " + handler.getPid() + " - - " + BOM + "null";
handler.publish(record);
Assert.assertEquals(expectedMessage, createString(out));
}

private void testMultibyteTruncation(final String part1, final String part2, final int charsToTruncate) throws Exception {
// Setup the handler
handler.setSyslogType(SyslogType.RFC5424);
Expand Down