LogMX tool and how to use it to view Vendavo log files

My colleague from JetMinds, Jiri Kratochvil, recently showed me a useful tool for viewing logs called LogMX.

LogMX is universal log viewer tool with nice and powerful graphical interface, where you can display log and trace files content and allows you to filters on levels (e.g. INFO, WARNING, …) and include/exclude classes and/or packages. LogMX was designed to read all log and trace formats from local or even remote files.

As we do a lot of Vendavo development in JetMinds, I obviously wanted to test it first on vendavo log file, as this is the most common log file I inspect. I found that before you can display vendavo log file, you need to do a bit of preparation first.

To test it you will need to configure a parser:

  1. Tools \ Options
  2. Click on Add Parser
  3. Enter Parser name – e.g. Vendavo default log parser
  4. Select Log4j pattern Parser tab
  5. Enter Log4j pattern: %d{MM-dd-yy:HH:mm:ss} [%t] %-5p %3c – %m%n  (or other, as specified in you config.properties file).
  6. Click OK 
  7. Open vendavo log file – LogMX should parse the log file now

That’s all.

Reklamy

How to monitor connection pool in SAP NetWeaver Java AS

Another interesting day today. And another experience with SAP NetWeaver Java application server. Our application (Vendavo of course) suffered with intermittent database connection problems in one of the customer environments. Like in many other cases, also in this case Vendavo is deployed to SAP NetWeaver Java stack.

In the application log files we found next exception stack trace from SAP NetWeaver:

Caused by: com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection for 60 seconds. Possible reasons: 1) Connections are cached within SystemThread(can be any server service or any code invoked within SystemThread in the SAP J2EE Engine), 2) The pool size of adapter „productionPool“ is not enough according to the current load of the system or 3) The specified time to wait for connection is not enough according to the pool size and current load of the system. In case 1) the solution is to check for cached connections using the Connector Service list-conns command, in case 2) to increase the size of the pool and in case 3) to increase the time to wait for connection property. In case of application thread, there is an automatic mechanism which detects unclosed connections and unfinished transactions. at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:59) at com.vendavo.core.omi.JDBCHelper.getConnection(JDBCHelper.java:267) … 36 more

More details about this exception can be found at help.sap.com.
After we verified that Oracle parameters PROCESSES and SESSIONS are set to sufficient values we came to conclusion that problem is in NetWeaver database connection pool, where the limits are hit. And that the most probable cause of the problem is connection leak. Somewhere database connections are not properly closed.
I found that SAP NetWeaver Java App server contains very nice connection pool monitor in its Visual Administrator. Real-time chart displays number of used / free connections in the pool.
We found that after a particular business action is invoked, limit of connections in the pool is hit almost immediately. Next figure shows that pool does not have any more free connections. All 100 connections are used.

We were able to find the code where the connection was not closed properly pretty quickly and the fix was easy. Next picture shows the same bussiness operation after we applied the fix:

I really appreciate the idea having the real-time connection pool monitor in Visual Administrator.
Btw. if you ever wondered where the connection pool is configured (maximum connections, initial connections etc.), it’s in the Additional tab of the given data source in the Visual Administrator:
Visual Administrator / Server / Services / JDBC Connector / Resources / Data Source

Local SMTP server for testing of email notifications

Testing of the email notifications – i.e. tests that business application is sending appropriate emails to right people is pretty boring but important part of the development of business applications. Developers are tend to underestimate this part of functionality.
Btw. although this piece of work is usually very simple, there’s very often a funny story linked to it. I can tell you several funny stories how hundreds of real users accross the globe were spammed from development environment with purchase orders, invitation to auctions or requirements for approval. This happened at least once in every company I worked for 😉
The best idea is to setup local SMTP server and use it instead of corporate one. And of course be careful to not allow the test emails to be sent to real users.

Recently my colleague @nemecpav showed me this ultra-simple application called Antix SMTP Server for Developers. This application is so simple, that I was even not able to find a way to configure for example a port where SMTP is listening. But at the end, why do would I need to change it?

And this application does the job perfectly. Zero configuration, just run it. And its free.

It’s running in a try, listening on SMTP port and behaves like a folder where all outgoing emails are placed. It’s a folder, so you can switch views in an explorer-like manner.

You can open the outgoing emails in the email client to verify the content, headers etc.

And finally – you do not need to worry that your test email will reach the real users 🙂