Programming

Using SL4J and SimpleLogger with Servlets

Sriram S
We saw in my previous blog that SLF4J and SimpleLogger support the most critical logging requirements with ease. In this blog, we will see how to use SLF4J in a Servlets based application. The general practice is to initialize logging related objects and parameters at the startup of an application. In case of Servlets, any of the servlet in the Web Application can be invoked due to user action. So we need to use a different technique for initializing logging related objects.

Log API Comparison – Java Logger vs SLF4J

Sriram S

Log statements help record the flow of an application’s execution. Hence they are an important part of software coding process. For the Java language the common Log API libraries are Java Util Logger (commonly known as JUL), Apache Log4J, SLF4J etc. While these libraries support many advanced capabilities, most developers only use a handful of features. For example, ability to send log messages to files and the ability change log levels dynamically etc.

In this blog I will compare JUL against SLF4J and focus on these above mentioned features. Many will argue that this is not a fair comparison since SFL4J is really a facade and supports JUL as well. To clarify, I will compare the SimpleLogger that is bundled with SLF4J against direct JUL usage.

Logger statements – the performance impact

Sriram S
Logger statements are among the most heavily used statements in most Java applications. While the code contains Logger statement at different levels, the common practice is to set a default log level for the entire application. This will ensure that only important statements are logged by default. The general understanding is that the statements below the default log level will not be executed and hence there is no impact to performance.

HTML5 Local Storage – 5 Useful Tips

Sriram S

HTML5 Local Storage is a browser based key-value database that is available for client side applications. Java programmers (like me) will find that  HTML5 Local Storage is very similar to HashMap (or Hashtable). It is important to remember that Local Storage is available to client side applications even across browser restarts. In that context, Local Storage is similar to cookies. **But unlike cookies, Local Storage is not accessible to the server side applications. **Also cookies provide very limited storage (4 KB).

HTML5 Local Storage based preferences for the URL Generator project

Sriram S

The release 2 (R2) of my URL Generator Project is now ready. You can check it out at the usual location. I am happy to share that this revision was completed on time as per my revised project plan. Of course the announcement was delayed a bit. The main additions to this version of the URL generator are HTML5 based Local Storage, a simple usage of Object-oriented JavaScript techniques and jQuery.

How I am learning JavaScript and CSS

Sriram S

At the beginning of the year, Scott Lowe, a specialist in virtualization, networking and storage, posted his project list for 2012. He had set a few goals for his learning and development. Last week [Scott posted an honest assessment][1] of how he has been performing on his own goals.

Why would anyone share their personal goals on the Internet? Because once you share your goals, visitors of your blog and people who know you would like to know how you are progressing. This curiosity will result in a sense of accountability and push you to ensure systematic progress on those goals. Another benefit is that you will plan your goals and the deliverables better.