File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How do I set the system time? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I set the system time?" Watch "How do I set the system time?" New topic
Author

How do I set the system time?

robyne vaughn
Ranch Hand

Joined: Jun 04, 2003
Posts: 38
I run java programs on an IBM AS400. In my logs (for java web-applications on Tomcat), messages are associated with a system time which is obviously out of sync with the system time on the AS400. Is there a JRE time I should set? How would I do so?
Thanks
Robyne
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

AFAIK, the JRE takes its time from the machine that it is running on. If you see different times in you log files, there are a couple things to check:
1). Are you looking at the correct logfiles? (Embarassing, but it happens to everyone...)
2). Is the JRE producing the logfiles on the same machine as the logfiles? If not, check the time on the machine where the JRE is.
3). How does the time get into the logfiles? If it is taken from a Database Server (e.g.,through a "select sysdate from dual;" in Oracle), then the time on the DB Server and your machine may be out of synch.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
robyne vaughn
Ranch Hand

Joined: Jun 04, 2003
Posts: 38
1). Are you looking at the correct logfiles? (Embarassing, but it happens to everyone...)

I'm sure.

2). Is the JRE producing the logfiles on the same machine as the logfiles? If not, check the time on the machine where the JRE is.

Yes, I'm talking about my web application logs on Tomcat on AS400

3). How does the time get into the logfiles? If it is taken from a Database Server (e.g.,through a "select sysdate from dual;" in Oracle), then the time on the DB Server and your machine may be out of synch.

Associating the time with the log files is accomplished in my server.xml where I specify timestamp="true

just now I forced an error to one of my logs. It logged it as
2003-11-11 18:19:46
According to my workstation and to the system on which tomcat runs, it should have logged something near 12:27:++

I would appreciate any more suggestions you might have.
Thanks,
Robyne
:roll:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I set the system time?