It�s because the builtin org.jboss.logging.LogStream is a bit
"straightforwardly" implemented (It simply overrides println(String), hence
the effect of print is not correctly logged).
Here is an example code (NOT TESTED, its taken from
org.apache.ant.tools.taskdefs.LogOutputStream of ant) how to replace it more
reasonably ... Rickard?
import java.io.IOException;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
/**
* helper outputstream that routes any print commands to
* a jboss logger
* @author jung
* @version $Revision:$
*/
public class LogOutputStream extends OutputStream {
protected ByteArrayOutputStream buffer =
new ByteArrayOutputStream();
protected Log log;
protected boolean skip;
/** Creates a new instance of this class. */
public LogOutputStream(Log log) {
super(System.out);
this.log = log;
}
/**
* Writes stuff into buffer until newline is detected
*/
public void write(int char) throws IOException {
final byte c = (byte) char;
if ((c == '\n') || (c == '\r')) {
if (!skip) flushBuffer();
} else
buffer.write(char);
skip = (c == '\r');
}
/** logs buffer input and resets buffer */
protected void flushBuffer() {
log.log(buffer.toString());
buffer.reset();
}
/** final flush */
public void close() throws IOException {
if (buffer.size() > 0) flushBuffer();
super.close();
}
}
-----Urspr�ngliche Nachricht-----
Von: Sternagel Annegret (PN-SYS/DAS)
[mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 12. Februar 2001 14:11
An: '[EMAIL PROTECTED]'
Betreff: [jBoss-User] System.out.print does not appear in server.log
Hello,
I'm working with jboss 2.0 FINAL.
For logging I'm using the default settings, so ConsoleLogging and
FileLogging are enabled.
When I call System.out.println(text) or System.err.println(text), the text
appears as expected in the console window and in server.log.
But when I call System.out.print(text) or System.err.print(text), the text
appears in the console window, but not in server.log. Even if I call
println() directly after print() only the text of println() appears in
server.log.
Can anybody tell me what's the matter / how to get text into server.log
using print() ?
Best regards
Annegret Sternagel
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]