java log code example

Example 1: how to get logarithm in java

import java.lang.Math;
int y = 69;
double x = Math.log(y);   // this will return the log base e of a number

// for log base b (anything else from e)
double x = Math.log(y)/Math.log(b);   // this will return the log base b of a number

Example 2: logging in java

Logging is the process of writing log messages during the execution of a 
program to a central place.This logging allows you to report and persist
error and warning messages as well as info messages (e.g., runtime 
statistics) so that the messages can later be retrieved and analyzed.

Example 3: java logger

private static final Logger LOGGER = Logger.getLogger( ClassName.class.getName() );

Tags:

Java Example