VASmalltalk – log4s – Transcript appender

When working under Windows you may notice – if activating log4s and you defined it – that a Transcript appender has been created for the main logger (the “root” logger) – but you will not see any output from that appender. The reason is simple: the appender points to TranscriptTTY – and not Transcript – and therefore the outputs are more or less lost. The appender behaves more like an EsConsoleAppender.

With the following one-line you may correct the current instance of the appender to do the output to Transcript:

| tAppender |
(tAppender := EsLogManager rootLogger 
                getAppender: 'Transcript') notNil 
  ifTrue:[ tAppender stream: Transcript ]

I think, that at that time, where the initialization is done, only TranscriptTTY is available and Transcript points to TranscriptTTY at those time. The new instance of the appender copies the content of Transcript at initialization time and that was: TransciptTTY.

You may also fix the code quickly by adding the following method to EsTranscriptAppender:

EsTranscriptAppender>>append: aLoggingEvent
 Transcript
   nextPutAll: (layout format: aLoggingEvent);
   cr
This entry was posted in Smalltalk and tagged , , . Bookmark the permalink.

One Response to VASmalltalk – log4s – Transcript appender

  1. Pingback: VASmalltalk – log4s and its design failures | Schrievkrom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s