baudehlo/Haraka — Issue #94: Logging
Author: smfreegard
Created: 2011-10-10 20:12:33+00:00
State: open

Since commit '28373500cb77eece0fc51e7959b1f68997925b57' - log output to the console is much worse:

For example:

[CRIT] SyntaxError: Unexpected end of input0[ 'SyntaxError: Unexpected end of input',\n ' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',\n ' at /root/Haraka/plugins.js:121:26',\n ' at Array.map (native)',\n ' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',\n ' at Object.createServer (/root/Haraka/server.js:60:13)',\n ' at Object. (/root/Haraka/haraka.js:39:8)',\n ' at Module._compile (module.js:402:26)',\n ' at Object..js (module.js:408:10)',\n ' at Module.load (module.js:334:31)',\n ' at Function._load (module.js:293:12)' ]
[CRIT] at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)1[ 'SyntaxError: Unexpected end of input',\n ' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',\n ' at /root/Haraka/plugins.js:121:26',\n ' at Array.map (native)',\n ' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',\n ' at Object.createServer (/root/Haraka/server.js:60:13)',\n ' at Object. (/root/Haraka/haraka.js:39:8)',\n ' at Module._compile (module.js:402:26)',\n ' at Object..js (module.js:408:10)',\n ' at Module.load (module.js:334:31)',\n ' at Function._load (module.js:293:12)' ]

The intent of the previous patch was to remove carriage returns from messing up the syslog output (as syslog on Linux doesn't handle this well).

How about changing line 33 of logger.js to:

data.replace(/\r/g, '');

It should then be up to the individual log plugin as to whether to filter LF's into \\n or not (syslog handled LF's without issue).

With this modification; my console log output is back to normal:

[CRIT] at Function._load (module.js:293:12)10[ 'SyntaxError: Unexpected end of input',
' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',
' at /root/Haraka/plugins.js:121:26',
' at Array.map (native)',
' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',
' at Object.createServer (/root/Haraka/server.js:60:13)',
' at Object. (/root/Haraka/haraka.js:39:8)',
' at Module._compile (module.js:402:26)',
' at Object..js (module.js:408:10)',
' at Module.load (module.js:334:31)',
' at Function._load (module.js:293:12)' ]