0

I want to make a log in mySQL using Java but I want to do the following: - Make a record with the CURRENT_TIMESTAMP - Update the record with an end time (so begin time and end time)

I can't post my code because I get an error when I try...

Thank you in advance,

Remco

user1879242
  • 13
  • 1
  • 5

1 Answers1

0

You could use log4j and use an appropriate apppender, like detailed in this question

The problem is that JDBCAppender is deprecated. Here is another solution if you really need this functionality : log4j-databaseappender, however it is very sparse on documentation (exactly, almost none), is a bit old, and has only one owner, but might serve as a good starting point if you want to roll your own. At least the code is small.

As for log4j, I'd certainly not try to reinvent the wheel and create another logging framework, when there is a readymade solution for a generic problem. If however you use another framework (which you didn't specify), I'm sure it would make the lives of your fellow colleagues easier not having to cope with different methods of logging... At least I'd be happy to see uniform logging instructions in the code I have to work on...

Community
  • 1
  • 1
ppeterka
  • 20,583
  • 6
  • 63
  • 78
  • actualy log4j JDBCAppender is deprecated, http://logback.qos.ch/manual/appenders.html, logback's DBAppender has been recomended by log4j's maker as a better alternative. – G-Man Dec 20 '12 at 09:36
  • @G-Man Thanks, I realizes that, and was already in the process of trying to come up with another suggestion to help the OP. – ppeterka Dec 20 '12 at 09:47