發表文章

Logging Best Practices

Logging in Java Reference: https://wiki.opendaylight.org/view/BestPractices/Logging_Best_Practices Java provides a diverse set of logging APIs and implementations. OpenDaylight has selected   SLF4J API , with the implementation being provided by the Karaf container. The primary reasons for this decision are: proper split between API and implementation, allowing us to change the implementation without impacting code ability to provide legacy APIs (JUL, JCL, etc.) for third-party code Message levels SLF4J defines five levels of logging messages, ranging from   TRACE   to   ERROR . The guidelines for their use are very vague and in the grand UNIX tradition mix severity of the message with its granularity. The following summary defines the basic rules on when to use a specific level, who the target audience is and how any message of the specified level will be interpreted. Note that all events with level   INFO or higher present an API-like contract...

Apache Log4j 2.0 - Worth the Upgrade?

圖片
The Apache Software Foundation   recently announced the General Availability of Log4j 2.0 , containing many   performance improvements   over its predecessor Log4j 1.x. Years in the making, this release was written from scratch, and gained its inspiration from existing logging solutions such as Log4j 1.x and java.util.logging. Log4j 2.0 introduces a new plugin system, support for properties, support for JSON-based configuration and automatic reloading of its configuration. It supports many existing logging frameworks, including SLF4J, Commons Logging, Apache Flume and Log4j 1.x, and provides a new programmer’s API. Christian Grobmeier , Apache Logging   PMC   Member, first wrote about   the new Log4j 2.0   in December 2012. He described the modern API: In old days, people wrote things like this: if (logger.isDebugEnabled()) { logger.debug("Hi, " + u.getA() + " " + u.getB()); } The log4j 2.0 team thought about things like that and impr...

Can't open and lock privilege tables: Table 'mysql.user' doesn't exist - Trying to run second instance of myslq

mysqld --initialize --console

Add third-party JDBC drivers on WebLogic

Oracle WebLogic data sources supports many databases types by default and also comes with some JDBC drivers for most of them. But, not very often, you are working with third-party databases (non-Oracle) and endup needing to download the JDBC drivers from the database provider and doing the setup on WebLogic by yourself. The steps are pretty simple, but some still have questions on how to do it and I will try to create a step-by-step guide on this post. In this example, the environment is  Oracle WebLogic 12c  running on a  Mac OS X and doing the simulation of a  Microsoft SQL Server JDBC Driver  installation. To simulate the issue of a missing driver, try to create a new Data Source selecting the following parameters on a default installation: Database Type:  MS SQL Server Database Driver:  Microsoft’s SQL Server Driver (Type 4) Version: 2005 and later Complete the wizard with your database access information (host, port, username, passwor...