alvin's blog

Log4J exception example - How to print the stack trace of an exception using Log4J (or Commons Logging)

Log4J exception FAQ: "How do I print the stack trace of an exception using Log4J or Commons Logging?"

Printing the stack trace of a Log4J exception seems to be something of a trick question. In reviewing Java code from different developers at different organizations I see a lot of people working very hard to print a stack trace using Log4J, including a lot of variations of calling e.printStackTrace() method. In this short tutorial I’ll show how to solve this problem.

How to use Spotlight to search for files from a Mac OS X Terminal window

If you ever want to use the Spotlight search functionality from a Mac OS X terminal window, you can access the same Spotlight information using the mdfind command. Here are a few examples of how to use mdfind to find files and directories on your Mac OS X system.

To find files with the word "alexander" in them, from a Terminal window you can use mdfind like this:

mdfind alexander

Now, if you just want to find a file using a portion of the filename, use this mdfindcommand:

Syndicate content