"She was not only a queen, but a supreme warlord, and that made her the most powerful person in the kingdom during her lifetime," David Freidel, an archaeologist at Washington University in St. Louis, said in a report released today . That description would put Lady K'abel in the same class as other ruling women of the ancient world, ranging from the biblical Queen of Sheba to Egypt's Hatshepsut and Cleopatra .
Freidel is the co-director of an excavation at the royal Maya city of El Peru-Waka in Gu...
By the way, I found a solution to my problem with the logging configuration file that I reported here . The problem was to find an evidence that the logging configuration file could be referenced without changing the command line to add the parameter:
Why not change the command line? Basically, because I want to avoid command lines and continue clicking twice on the .jar file to open the application or enable a personalized logging if the application is distributed by Java Webstart .
Logging is a great way to communicate the systems past steps and state for debugging. Often, they are the last resort to get an idea about what is happening in a remote system. But, not all is shiny. Usually, the log entries are printed onto the console and to a file. The later one is no problem, however, the first one can be a pain point. How? Assuming you have an application with a good suit of unit tests. Say a couple of hundreds so that the output of running the tests does not fit on one sc...
While logging can be very useful in an application, it's still a question to me whether it is desirable to use logging statements in a library. If the library is well-designed, is there a need for logging? Is it not up to the application to log what seems relevant to it? Use cases for logging There are use cases for logging events in your application, including performance logging of audit logs. These can be seen as the implementation of functional requirements, and are typically implemented usin...
I wrote on how to understand hs_err files earlier on this blog. Let's discuss the nature of hs_err files today.
Basically a hs_err files is what you get when something goes wrong during a local Java session. Local as in using a Java Virtual Machine (JVM) locally. The HotSpot VM is the default JVM for the Java SE plattform. Hence the name of hs_err files: HotSpot Error log .
Description of JVM error files
A hs_err log file is being created by the JVM when a fatal error occurs. It contains useful debu...
In a previous post I explained how to Fish the UCS API Pool with Wireshark . That was hard but very important method to know. Like all things in life, there is an easier way (as also highlighted by A Friend !). It's nice to have friends, even if they are anonymous which makes birthday parties hard to plan.
Anyway, let's recap why we need to do this:
You may want to develop your own code against the UCS API for many reasons, maybe you're lazy and nosey? Sorry, I meant efficient and creative, of...
liferay 6.x portal default portlet configuration does not display minimize and maximize icons on portlet headers. These buttons are only available to admin role users. For one of our projects, we had to display the minimize and maximize button for all of our logged in users. We tried to do a lot of research and realized that there is no easy way of doing it in liferay 6.x portal. This post is about a simple workaround we have found which will start showing minimize and maximize icons on all lif...
You can see in blackberry that behavior of real device differs from behavior of simulator for same code. If you are getting some bugs in your application that is only reproducible in real device, now for debugging you only have two options. 1. Device side debugging. 2. Logging Here I am going to explain logging that can save your lots of time to find bug. Logging is required because System.out is not usable on real devices. For logging we can use EventLogger class.
I read a good article tonight about implementing application level logging using log4J, and I thought this concept could be extended and abstracted one level further by making use of the Apache Commons Logging API . Using the Apache Commons Logging API allows the logging implementation to be abstracted away from the application; resulting in application logging code that can be reused even if the logging implementation changes. There has been some criticism of the Commons Logging API for many yea...
One of the challenges in any programming environment is to be able to debug the code effectively. While developing Java applications you can print to standard output ( System.out.println("This is a debug message!" ) to observe the execution of the program or look at the stack trace when an error ( java.lang.Exception ) occurs in the application or you can also use breakpoints in development tools ( Eclipse).
Suppose an application is not running properly in the production environment, yet in the deve...
Every now and then, I get a request about sample code for logging into Netsuite. I often forget that I started working with Netsuite in CF before I commonly used native java objects. It took me some tinkering to figure out, but when dealing with Netsuite specific datatypes and objects in ColdFusion, sometimes CF will often correctly translate an array, integer, string, etc to an equivalent compatible with the SOAP request, however often I just skip the middle man and eliminate risk by casting t...
Ever seen this linkage error. This is caused by various reasons of duplicate jars containing xml-apis.
I had this issue when I included Apache POI jars (poi-ooxml-schemas) which in turn included stax-api jars (geronimo-stax-api_1.0_spec.jar, stax-api.jar) and xml-api's (xml-api.jar, xmlbeans.jar).
Excluding them from your dependency would solve the issue.
Amazon web services' S3 REST API supports custom access log information by adding custom query string parameters beginning with "x-" that S3 ignores but logs.
Unfortunately custom query parameters are not directly supported in the AWS Java SDK , so we were planning
to drop down to writing HTTP REST code for a recent project that required logging
of some custom client-session parameters.
I hate working with HTTP, so I was glad when we figured out a workaround.
The trick we came up with was to ...
I created a Java Service in webMethod's Integration Server that should log something to the server.log file. As it turns out, this is quite simple:
Generate Java code for calling the internal Service pub.flow.debugLog by right-clicking on the Service in Software AG Designer and selecting Generate Code , For calling this service from another service . The code gets copied to the clipboard automatically.
Paste the code snippet into your Java Service. It may look like this:
I recently had to come up with a logging solution for a JNI DLL/shared library that was written in C++ and is providing the data translation layer between Java and the native libraries. As usual, some logging was required to aid fault finding in a production environment, if necessary. A quick survey of the state of C++ logging showed that not a lot had changed since I last looked at logging libraries for C++. In fact, a lot of them seem to have survived unchanged for several years. I'm not sure ...
Java comes with a built-in logging system java.util.logging which is really quite good. It is very simple to use, highly customisable at runtime and offers incredible extensibility. However, by default it doesn t allow you to specify the format of your logging messages and this tends to make people angry (the default setting is to print everything to System.err, over 2 lines). In this article I m going to talk a little bit about why you should use the built-in logging package and show you h...
I have been very busy lately as I am still writing my PhD thesis many apologies to my readers, I promise to become more active as soon as I can
Here is a collection of (not that) random thoughts I have collected over the week.
Guilder is a promising build management project that wants to fix the Maven shortcomings. It is based on Groovy to make a nice internal domain-specific language. Oh and it uses IzPack
Groovy is an amazing productivity booster I've been writing research prototypes using it ...
This article will provide a quick overview of log forging and discuss a couple simple solutions to prevent it.
3rd party logging library The 3rd party logging libraries are the workhorses of the java logging world. They are probably the most used option and for good reason. The popular frameworks provide very simple configuration, offer all the basic features (and even some advanced features), and can be setup to log the same meta-information for each log entry (such as timestamp, username...
If you're working with Amazon Web Services and their Simple Queueing Services (SQS) in particular you might want to consider using ElasticMQ for your tests. ElasticMQ is a standalone message system written in Scala with an SQS-compatible REST interface.
In order to add ElasticMQ to your project dependencies follow the instructions on the project page. Detailed instructions on how to add it to your Maven build are available there. Mind that you'll only need those two artifacts: elasticmq-core_2....
If you come from a Java or C# perspective and want to create a multi-dimensional array in C or C++, you'll soon figure out that multi-dimensional array allocation in C\C++ is not as simple, plus you'll have to worry about deallocation since there is no garbage collector to do the work for you. Below I'll show four different sample codes showing how to work with a three dimensional array in Java, C#, C++ and C, respectively.
In Java, creating a 3-dimensional array is as simple as saying
This class is intended to log when a method executes and when a method ends and include the time it took for a method to execute in nanoseconds. Methods inside methods are tabbed. This is an enhancement to this post: AOP Logging all method calls and executions
package mainExample;
import java.util.Stack;
import org.aspectj.lang.JoinPoint;
public aspect AspectLogMethodExecution
{
private int tabCount = 0;
private Stack _StartTimeStack = new Stack();
pointcut AnyMethod() : (c...
I have found that using slf4j is the best bet when logging with App Engine for Java . You log against their API and then you provide a binding to any of the supported logging frameworks at runtime. In the case of App Engine, java.util.logging is used primarily, however is isn't as flexible as log4j so in order to get around this, I use a slf4j and a log4j binding during development and a jdk (java.util.logging) binding for releases/deploys. This means that all my logs will be accessible throug...
With all its modularization, dependency injection and service location, it may be hard to figure the initial setup of a TrueZIP 7 application. Among other things, the initial setup determines which archive file suffixes will be detected by the application, e.g. .zip or .tar.gz . This post shows you how you can use java.util.logging to observe your application figuring its initial setup from the services available on the class path at runtime.
TrueZIP 7 uses some service locator singletons to ...
In this tutorial we will see how to set logging levels to control the log messages being logged when application is running in different mode(production, testing, development etc.). Logging level defines the severity or importance of message being logged. In this example we will see how to change the logging levels at coding level. You can use properties file to change the logging configuration, check Java Logging configuration tutorial for more details.
In this tutorials and example we will see how to log messages using Java Logger APIs. This also give you basic idea of various possible Log levels.
As we haven t configured the log handlers and formatter the default values will inherit as per the settings in logging.properties file.
Java Logger related classes are available in java.util.logging.* package. We will make use of java.util.logging.*.Logger class to create a Logger and log the messages. Level class defines the various logging ...
In this tutorial and example of Java Logging we will see how to configure Java logger using properties file. This configuration file need to pass to your application using java -Djava.util.logging.config.file option. The logging behaviour of Java logging can be controlled programmatically or using configuration files. Externalizing all logging related configuration is one of the highly recommended best practice in Java as it allow you to change the logging behaviour without recompiling or red...
My last post suggested an extension to the Java language that I think will be quite helpful. Until such a feature exists, we can fake it by using annotations.
I created an annotation with a processor that creates a new class, one the contains a single static instance of an array of the parameter names from the constructor.
All code on this page released under the same license as the OpenJDK Libraries: GPL with the classpath exception.
There is a very small feature that could be added to Java in order to improve it significantly: Add names to the Parameter object in the Reflection API.
When creating a new Object in Java, the parameter list for the constructor or factory provides the contract. Unfortunately, a key element of this contract is missing at run rime when it is needed most. If a constructor takes multiple values of the same type, the only way to distinguish between them are the names of the parameters. For...
Fedora and Debian play the role where many chaotic projects get a degree of charm school: they learn to play nice with a lot of other projects. In Fedora, as near as I can tell, there is only one Java based web application packages as part of the distribution: Dogtag, the Public Key Infrastructure server. As we look at how PKI should look in the future, the dearth of comparable applications packaged for Fedora leaves us with the opportunity for defining a logical and simple standard packing sche...
This is not an Anti-Java rant Per Se. It is a rant about the two main things missing from the language that force people into code heavy work-arounds.
Java has two flaws that hurt programmers using the language. The first is that the reflection API does not provide the parameter names for a function. The second is that Java allows null pointers. This article explains why these two flaws are the impetus for many of the workarounds that require a lot of coding to do simple things. This ...
As you probably know using System.out.println for logging in Java is a no-no and this is also the case when developing plugins for Notes 8 and Lotus Expeditor. This post outlines how to use the logging framework supplied with Lotus Expeditor, how to manage the logging and where the logs go.
You have probably been using log4j or similar logging framework for years. Avoiding writing to System.out is even more important when writing SWT components and plug-ins for Notes 8 a.k.a. Eclipse since th...
A recent feature addition that I've been working on for Altos Research requires that our server-side application be aware of our LivePerson on-line support status. Although LivePerson provides sample client-side javascript utilities for this purpose, there are times when your sever app just needs to know if your support representatives are online, busy, or offline.
public enum LivePersonStatus { offline, online, unknown, occupied }
public static LivePersonStatus getStatus(Integer lpNum) { ...
As systems administrators, application logs are often the key to our success, but also our biggest hassle. They provide clues to what's going on when things go awry, and in those situations more detail is generally better. But when you don't actually know something is wrong, and just want to get a sense for whether things are normal , more detail can create so much noise that it's all but impossible to glean any useful information.
In those situations, you'd rather just have statistical informati...
It has been talked about many, many times, so now it is naturally widely-known that any application, especially one that s in production, must be monitored. When monitoring, it is important not only to evaluate the current status of the application, but, even more importantly, to predict future potential error situations. It is already standard practice that application programs write log files. These usually contain various information from many different points in the application. Therefore ...
Bringing business and technology expertise together.
When I first started doing development in Java back in 2000, there wasn t a free logging framework available (at least not that I was aware of) so my development team wrote our own. Building a robust logging framework is not a trivial task, and thankfully Ceki G lc stepped up with log4j which was hosted by Apache and reached 1.0 in January 2001.
Java eventually got an official logging API in version 1.4 a year later, but as is common with f...
In our team, we have a lot of Java standalone applications which should be run as daemon on Unix/Linux system, and we found JSVC is the best choice for us to wrap Java programs to daemons. This article records the steps on how to install JSVC executable on Mac OS X, which is my development environment.
Versions used in this article:
Download JSVC source package First of all, we need to download JSVC source package from this URL: http://commons.apache.org/daemon/download_daemon.cgi , for example, I ...
By default, the Sun SeeBeyond Integration Server domain uses a single log to log all events, whether arising out of execution of the Integration Server or arising out of execution of Java CAPS solutions deployed to it. This log is named server.log and is kept in the <JavaVACPInstallRoot>/logicalhost/is/domains/<domainroot>/logs directory.
This note discusses how the Integration Server can be configured to deliver all or selected events to an additional log handler and how XML-formatte...
In my recent course work I found the need for wanting to have a key value type object which maps one key to multiple values.
This could be easily accomplished in Java using a HashMap and a list or set. Doing HashMap would be very nice if you knew all the values you wanted to have mapped to the same key. Unfortunately, my use case wasn't that simple. And it wouldn't be very practical to manually maintain a reference to a list for each key.
I had to build a plugin framework in Java which allowed plu...
Search engine companies collect the database of intentions, the histories of their users' search queries. These search logs are a gold mine for researchers. Search engine companies, however, are wary of publishing search logs in order not to disclose sensitive information. In this paper we analyze algorithms for publishing frequent keywords, queries and clicks of a search log. We first show how methods that achieve variants of k-anonymity are vulnerable to active attacks. We then demonstrate t...
The Good news keeps rolling for India!! We have a hot new Symbian and Java Nimbuzz update ready for download
We had received a lot of queries from all of you regarding issues related to Nimbuzz Connectivity from your mobile phones like, unable to connect Nimbuzz , trying to connect , Login Failed and more.
Symbian phones such as the recently launched Nokia C6, C3, and E5 will definitely benefit from this update. Even the owners of the popular Java phones like Micromax Q3, Samsung S...
As promised in this previous post , I will start this short serie by the JavaEE application servers jungle. As a side-effect I won't consider Tomcat as it is not a full-stack application server. Also, I will only consider the opensource JavaEE servers.
JBoss is an obvious option when it comes to JavaEE application servers. In fact, it delivers very well. I found the JBoss application server to be very easy to use. The documentation is good. You quickly forget that you are running it once your favo...
Following this post and this other one , I am now exploring the Java integrated development environments, still with JavaEE teaching purposes in mind.
I will briefly review Eclipse , Netbeans and IntelliJ IDEA (yes, it is not opensource, but they give free classroom licenses).
Disclaimer #1: most of the things I say here are based on personal taste and experience. Hence, my opinion is highly biased . Also, there is nothing scientific in the claims that I make. You have been warned
I am currently experimenting / prototyping some code that makes an intensive use of Java NIO features. The code that I am writing is tested on large sets of data (around 200 MB for an average test).
Although I cannot share the code, I thought that I would share with you some suprising results, hoping that some Java VM expert can pop up and tell me why on earth I am getting those results
I did a first naive implementation: whenever I need a byte array or (heap) ByteBuffer , a new instance is creat...
After seeing Blochs' session on Javapolis last year and some of the Java 7 sessions at JavaOne this year I gave up on closures in Java. I just didn't believe that they would be part of Java 7 anymore. I also had my doubts on the quircks' of the BGGA proposal.
Playing around with the BGGA prototype changed my opinion though. It might not be as concise as closures in Ruby, but it _is_ a really useful extension of the Java language.
The following code I wrote runs fine with the BGGA prototype:
2012/05/19 plagwitz Leave a comment Go to comments
MyLyn Web Connector 3.8 for Eclipse Indigo
I next got an error ( Cannot complete the install because one or more required items could not be found. Software being installed: Mylyn Incubator SDK (Incubation) 3.8.0.I20120414-0402 (org.eclipse.mylyn.experimental_sdk_feature.feature.group 3.8.0.I20120414-0402) Missing requirement : Mylyn Tasks Connector: Web Templates (Advanced) (Incubation) 3.8.0.I20120414-0402 (org.eclipse.mylyn.web...
Currently there are a number of options to choose from:
The built-in java.util.logging . This would seem like the obvious choice since everyone already has it, however configuration and options for what happens to the messages have always been lacking. Just getting file to roll over every night requires custom code. Getting messages to go to an NT event log or something else more exotic is even worse.
Log4j : This was one of the first and better frameworks for logging in Java that had a well tho...
The problem is that though logging is a simple thing to do, doing it
correctly needs a lot of practice, experience and understanding. That
makes it more of an art than a science. In my personal experience,
mastering the art of logging requires lots of patience, experience and
forward thinking. It s quite difficult to teach someone how to do it
(sort of tacit knowledge), and most freshers tend to see the effort put
into writing to log files as something additional. But all that effort
pa...
For a long time we Java programmers have relied on conditional blocks to guard against unneeded string concatenations and other expensive computations that occur when we want to create complex log messages. In other words, we want those concatenations to occur only when the logger will actually log them.
While SL4J's use of vararg parameters eliminates a huge chunk of these conditional blocks, there still are (possibly rare) cases that creating a log message involves more than just string concate...
LogEval parses and analyses server log files such as Apache or Nginx logs. LogEval can be used instead of web-analysis tools such as Google Analytics or Piwik to save resources or in addition to those tools to get a broader picture of the webserver traffic. The LogEval version available as download is a fully functional prototype written in Java. It still has some weaknesses namely bad error handling in some areas and performance issues if the log file becomes too big (on my computer a 14mb ...
One of the most popular uses of JMX is to change the logging level of an executing Java application that utilizes Java's built-in logging ( java.util.logging ). This is made possible by the platform MBean server and the built-in LoggingMXBean . As an example of this, consider the simple Java class below.
The Java Application that Logs
package dustin.examples;
import java.util.logging.Logger;import static java.lang.System.out;
public class FickleLogging{ private static Logger LOGGER = Logger.get...
This tutorial describes the impact to performance of wrong logging. In enterprise software one very common performance killer is logging. Don't get me wrong, logging is absolutely necessary during development, test and in production.
Quite often a logger is just created and use it like in the following code:
// Standard Version
LOGGER . info ( MESSAGE_PREFIX + Math . random ( ) + MESSAGE_SUFIX ) ;
A recent project requirement forced me to learn a lot more about the current state of Java logging that I ever really wanted to know. For the most part, I've always let other people pick the logging framework that a project uses and just sort of coasted along without paying too much attention.
Since all of the logging frameworks generally use similar interfaces, I've never really had to pay attention to which logging framework a given project is using. I thought I'd write a short piece about the ...
The Logging API in Java enables Applications to log messages of some level which will be very useful for debugging purpose. Say, if a system fails for some reasons, then the reason can be easily traced out by looking at the information available in the log file. In this section, let us see an overview of using Logging facility in Java.
Starting from 1.4.2, Java provides the capability for Applications to log messages through the package java.util.logging and the core class in the API is the Lo...
I have done a lot of work in Android Programming, PHP, JAVA J2SE, JAVA J2EE, .Net as well as Webdesigning and currently working as a freelancer and Trainer at Microsoft IT Academy. I am having a keen interest in Learning new Technologies and sharing the Knowledge.
This is the best way for creating Error log files as XML provides Finest and Understandable Format for New Programmers.
During a moderate load below error appears in weblogic logs : Connection reset by peer: socket write error
They are running Weblogic in a windows 2003 ESX vmware environment.
The configuration starts with a RHEL 5.1 running apache, cluster of 6 servers with the weblogic plugin. The plugin points to a cisco load balancer which will forward the requests to a weblogic tier servers. The weblogic tier has a cluster of 4 servers and another 5 managed servers.
Below Figure shows the fields that identify an application s live data size. It is wise to compute an average of the Java heap occupancy and garbage collection duration of several full garbage collections for your live data size calculation. The more data you collect, the better the estimate for a Java heap size Using the live data size information, an informed decision can be made on an initial Java heap size to use along with an estimate of the worst case latency due to full garbage collecti...
A while ago I set out to fix a couple of focus problems in a GUI at work. One of the problems was that after a certain user operation, all keyboard shortcuts stopped working (as you may know, keyboard events are dispatched up the focus chain until a component handles them). Another problem was that after the user clicked in a component, another component would start flickering. Actually, the problems are not that important, but the way to solving them are!
Java Logging API was introduced in 1.4 and you can use java logging API to log application messages. In this tutorial, we will learn basic features of Java Logging API with examples of different logging levels , Logging Handlers , Formatters , Filters , Log Manager and logging configurations .
java.util.logging.Logger is the class used to log application messages in java logging API. We can create java Logger with very simple one line code as:
I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application running on Tomcat. How can I do this? I want to know the remote user accessing my web app. This user is logged on a active directory Thanks! ..
This is my solution: Put jcifs-1.2.7.jar on [TOMCAT_HOME]/common/lib directory. Modify application's web.xml adding the followin text to section webapp: NtlmHttpFilter jcifs.http.NtlmHttp...
In an attempt to create a simple logging class for a Java socket server application I was writing I wanted to make sure that the class captured all log events from the various threads sending messages to it. I didn't want to have the situation where some messages were lost because the class could not handle the log messages being sent to it.
In order to do this I decided to use a Consumer Producer concept. Thankfully in Java this concept has already been thought of via the use of java.util.co...
The logging libraries provided with Java 5 and above are pretty good, except they produce output that is almost unreadable. For example, consider the simplest example:
Logger logger = Logger .getLogger( " PushServer " );
logger.log( Level .SEVERE, " This is a sample message " );
That produces the following log entry, on your screen and/or in a file:
Individually, that's OK, but 20 messages? Messy. 1000 messages? Pretty nasty. 100 threads each generating a stream of FINE messages? Yikes.