Rasmus.krats.se

English

Skriverier då och då, på webben sedan 1995

Taggat debugging

Some ways to log stuff in java

Publicerad taggat , , .

Logging in java is a mess. For a long time there was no standard way of logging in java, so there is a lot of 3:rd party solutions. Apache commons logging, slf4j, and log4j are probably the most used.

By now, there is standard java.util.logging package, but most people stick to the old 3:rd party solutions. As we shall see, that isn't really surprising, since java util logging kind of sucks.

Läs och kommentera inlägget Some ways to log stuff in java

Logdriver

Publicerad taggat , , , .

When developing code with Hibernate (or other Java tools that create SQL statements for you) it is often a good idea to take a close look at the generated SQL code, for example if you have performerance issues.

A very nice and simple way to do that is logdriver by Ryan Bloom. (Update 2017-06-24: Unfortunatley, the domain seems to have been lost to a spam site).

And it's simple to use! I've got a .properties file where I've commented out the ordinary db driver and use logdriver instead. As simple as this:

# DB_DRIVER=oracle.jdbc.driver.OracleDriver
# DB_URL=jdbc:oracle:thin:@dbhost.mydomain:1523:db
DB_DRIVER=net.rkbloom.logdriver.LogDriver
DB_URL=jdbc:log:oracle.jdbc.driver.OracleDriver:oracle:thin:@dbhost.mydomain:1523:db

Kommentera inlägget