Ulf Dittmer wrote:If it's a web app, what part do you envision Java to play? Streaming log entries to an HTML/JavaScript client? Or in an applet that reads from a streamed server source?
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
James Sabre wrote:It may not be tested to the level you require but reply #10 of http://forums.sun.com/thread.jspa?threadID=709737.
Of course you could always write a test harness for yourself!
Well... As I said, it is very easy to copy paste some example code from the net. But that is not what I am looking for.
How do I know that anyone else is using this code currently?
And can I get news of any bugs found?
The most likely scenario is that if anyone uses that code and then later finds some bugs he simply tries to fix the bugs himself and I have no idea about it.
But the lack of response seems to indicate that what I am looking for doesn't exist. And I guess that the example code you link to is better then nothing. Although I just tested it, and it can't handle windows line breaks (CR + LF becomes LF + CR and that is interpreted as two separate line breaks), so I had to fix that. Also it doesn't handle UTF-8, but that I can live with I guess.
.
Thanks for the tip, even though I'm still a bit perplexed about the fact that I have to reinvent the wheel like this
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Paul Clapham wrote:Going back one step from your "tail" requirement to your original requirement of being able to display log entries from one application in a second application...
If I wanted to do that, here's what I would do:
Use log4j in the application doing the logging Configure it to use a SocketAppender Have the second application run a SocketServer to receive the logs
Now perhaps you can't do that, in which case just disregard the advice. But I have actually done that (in my case the second application actually needed to act on entries in the first application's logs.)
Jimi Svedenholm wrote:I actually got inspired by your suggestion, and decided to try and write my own appender, and it was quite simple.
Sure, it doesn't give me access to events logged before a restart/crash, but that is a minor issue
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
James Sabre wrote:
I had to produce that code in the first place because, like you, I needed tail() type functionality for a home project for looking at log files. I was primarily using iso-8859-1 encoding and I think I said in the thread that it did not work for multi-byte character sets. I have moved on since then. I developed an improved version for a customer that handles the Java mandated character sets of US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE and UTF-16. It actually handles all the iso-8859-x character sets and may handle others by accident. The only character sets it is known to fail to handle is EBCIDIC family though there may be others. It deals with the CR-LF problem.
The new improved version is quicker than the original and the heart of the code is actually much smaller than the original. I cannot release it since it is owned by my customer.
Why perplexed? Surely this sort of deficiency is what drives the Jakarta projects.
Rob Prime wrote:
Jimi Svedenholm wrote:
Sure, it doesn't give me access to events logged before a restart/crash, but that is a minor issue
You could try parsing the existing file when the appender is created for an initial list of events. Afterwards you simply toss those away as your list gets more and more events.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |