prcsn1
asked on
How to write to Windows Event Log
I write server-side applications in Java. These are frequently deployed on MS Windows servers. I'd like to be able to write errors to the MS Windows Event Log.
I have seen some code covering this through JNI, but it is pretty horrible. Has anyone any reasonable simple code - or a package - that does this?
(I have looked at
http://www.javaworld.com/javaworld/jw-09-2001/jw-0928-ntmessages.html?
but it's fairly old and not very nice. I'm hoping for a better way. Is there an ActiveX I could call with Jawin, maybe?).
regards
Simon in Sydney, where the weather isn't as nice as it should be by now)
I have seen some code covering this through JNI, but it is pretty horrible. Has anyone any reasonable simple code - or a package - that does this?
(I have looked at
http://www.javaworld.com/javaworld/jw-09-2001/jw-0928-ntmessages.html?
but it's fairly old and not very nice. I'm hoping for a better way. Is there an ActiveX I could call with Jawin, maybe?).
regards
Simon in Sydney, where the weather isn't as nice as it should be by now)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Yuk. JNDI.
JNI actually. But all the works already done in the article so there's really not much left to be done. So you don't need to actually write any JNI yourself.
> Actually I find base Jawin excellent.
Yes jawin is nice, but it is just a JNI DLL providing a generic Java interface to Windows DLL. Whereas the code in the article provides a more focussed DLL for performing the task you require.
> I think I'll go sailing and have the Sydney Harbour to myself!
enjoy :-)
JNI actually. But all the works already done in the article so there's really not much left to be done. So you don't need to actually write any JNI yourself.
> Actually I find base Jawin excellent.
Yes jawin is nice, but it is just a JNI DLL providing a generic Java interface to Windows DLL. Whereas the code in the article provides a more focussed DLL for performing the task you require.
> I think I'll go sailing and have the Sydney Harbour to myself!
enjoy :-)
ASKER
JNI, JNDI, let's call the whole thing off.
Currently battling to get it to work. It's resisting ...! It looks as though the C stuff has worked - but the Java side is resisting, dammit ... I've only been coding for 30 years, one day I'll get it right ... or maybe I should stick to sailing.
Currently battling to get it to work. It's resisting ...! It looks as though the C stuff has worked - but the Java side is resisting, dammit ... I've only been coding for 30 years, one day I'll get it right ... or maybe I should stick to sailing.
Whats the problem exactly?
ASKER
Java doesn't want to run the class. It's usually some dopey problem with the classpath when this happens. But as I don't have one how can it be ... ah, got it. Needed a classpath of "."
Silly program ...
Ok I seem to have an output into the Event Viewer.
Hooray! About time too.
Great. Thanks for the encouragement - want to come sailing?
Silly program ...
Ok I seem to have an output into the Event Viewer.
Hooray! About time too.
Great. Thanks for the encouragement - want to come sailing?
ASKER
Ok. I'll try the suggested stuff.
Yuk. JNDI.
Actually I find base Jawin excellent. But the resouce stuff makes it a bit tricky.
Not too worried about the Wallabies - hey, I think I'll go sailing and have the Sydney Harbour to myself!