Solved

How to write to Windows Event Log

Posted on 2003-11-16
7
523 Views
Last Modified: 2012-06-27
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)
0
Comment
Question by:prcsn1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 9761385
that solution looks about as good as you'll get.
(Calling an ActiveX component with Jawin is a lot messier in my opinion)

> where the weather isn't as nice as it should be by now

And its just started raining again :(
But as long as it's fine on the weekend for the wallabies I'm happy :-)
0
 
LVL 2

Author Comment

by:prcsn1
ID: 9761508
Sometimes - actually pretty often - I feel people go a long way out of their way to make things hard. (Actually, listening to my co-worker battling to get IIS/BizTalk, Certicates, Web Services to function together, I think these same people may be spending ALL of their time making things hard).

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!
0
 
LVL 92

Expert Comment

by:objects
ID: 9761557
> 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 :-)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:prcsn1
ID: 9761621
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 9761627
Whats the problem exactly?
0
 
LVL 2

Author Comment

by:prcsn1
ID: 9761650
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?
0
 
LVL 92

Expert Comment

by:objects
ID: 9761677
> want to come sailing?

Love to :-)


http://www.objects.com.au/staff/mick
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
couple of eclipse 5 52
fibonacci ten numbers 4 54
Why is enum singleton a better approach than static factory 3 51
jsp error 6 46
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationā€¦
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question