Forums Register Login

how to generate the unique message id for log message

+Pie Number of slices to send: Send
In my client program I want log the message with unique message id. I am using apache log for the log message, but I don't know how to generate the unique message id

Could anyone help me to solve this problem?

thanks in advance
+Pie Number of slices to send: Send
Not sure if this is exactly what you are after but you can use.

java.rmi.server.UID

to create a unique ID.
+Pie Number of slices to send: Send
well, if you have one application, write a class where you are sure that only one instance ever exists (avoiding the word "singleton" here) :-)

delegate the responsibility to initialize and increase the id to that class.

write a getter for the id

make sure everyone who needs an unique id only aquires it through the getter method.

hope it helps,
jan
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1644 times.
Similar Threads
Generate Id.
distinguishing 2 browsers in the same session.
auto generated unique Id?
Creating Unique Id
Javascript Dynamic Dropdown Box validation
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:36:33.