1
2
3
4
5 package com.amowers.samples.logging;
6
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9
10
11 /***
12 * @todo put class comments here.
13 *
14 * @author amowers
15 *
16 */
17 public class LogIt {
18 private static final Log LOG = LogFactory.getLog(LogIt.class);
19
20 /***
21 *
22 */
23 public LogIt() {
24 LOG.info("constructing");
25 LOG.debug("constructing with no parameters");
26 }
27
28 /***
29 *
30 */
31 public final void doSomething() {
32 if (LOG.isDebugEnabled()) {
33 LOG.debug("doing something");
34 }
35
36 try {
37 int i = 1 / 0;
38 i++;
39 } catch (Exception e) {
40 LOG.error("caught an exception while doing something", e);
41 }
42 }
43
44 }