Fandom

Scratchpad

Audible Developer Orientation

216,229pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Logs and Common Errors

Logs are a useful component used by developers to debug applications, determine errors, identify exceptions.

Audible Development environment is classified into 13 zones (0 to 12).

Development work Is carried out on twelve zones (1 to 12). Zone 0 is the integration zone, where the consolidated development work from all zones lies.

All further references with respect to the development would be made to zone 1 IM

Hostname for zone 1 IM : im-a00-01.mgt.dev.sec.audible.com

Logs are placed on the IM server under the following folder path:-

/opt/bv1to1_var/logs

Logs that are extensively used by developers (bvlogs and javalogs) can be found under

/opt/bv1to1_var/logs/im-a00-01.ofc.dev.ewr.audible.com on the IM server

Under the path mentioned above, the log files can be found on a datewise basis.

There are separate log files corresponding to each day.

For eg:- Log files corresponding to 17th May, 2008 are

bvlog.out.20080517

java.out.20080517

Any errors/exceptions can be seen in the bv logs.

Any log statements put in the code can be viewed in the java logs.

Steps to view logs:

1. Go to the path /opt/bv1to1_var/logs/im-a00-01.ofc.dev.ewr.audible.com on the IM. Open a new terminal and type the command to view the logs.

2. Command to view the logs:-

a) java logs : tail –f java.out.20080517
b) bv logs : tail –f bvlog.out.20080517
Please modify the commands to put in the correct date.

3. Hit the URL in the browser.

4. The logs should display on the terminal.

5. Logs once started can be stopped by using the command CTRL + C

Putting Log statements in the code:

Need to import com.broadvision.util.BVLog on your jsp/java file

A log statement can be printed using the following syntax:

BVLog.error("Some string: " + some_variable);

All such log statements can be viewed in the java logs using the commands mentioned above.

Please make sure you comment out/ remove all the unwanted log statements after your development work.

Common Errors:

Here are a few of the most common errors that a developer is likely to encounter in the beginning.

These are mainly exceptions that are difficult to identify on the code.

1. Null Pointer Exception.

The exception shows in the bv logs.
The bv logs when run will display the exception alongwith the filename in which the exception occurred.
It happens when you are using String methods on a null String.
Make sure you always check for a null string before using methods on String variables.
Also, while comparing a String variable with a String literal , use
"abc".equals(String var) instead of
(String var).equals("abc")
The first one will avoid a null pointer exception incase you forget to put a null check.

2. Array Index Out Of Bounds Exception

  The exception shows in the bv logs
It happens when you try to access an element of an array beyond the length of the array.
  Normally, array elements are parsed inside loops. Make sure you terminate the parsing once that last element has been read.
One common area at audible, where this exception does occur is while implementing pagination.
Suppose you need to display 10 records on a page and you have 24 records.
  You put in the code for display. The first 2 pages run fine. The last page throws an Array index out of bounds exception.
  Make sure on the last page you have overridden the 10 with 4(in this case) so as to avoid this.

3. Number Format Exception

The exception shows in the bv logs
Many a times you would use the Wrapper class methods such as Integer.parseInt(String var)
This would convert the String into an object of type Integer or even an int variable.
Number Format exception would occur when the parameter is null.
Integer.parseInt(null)
  This usually happens when you need to convert a request parameter that has been received on the page into a number.
  The flow works fine when there is a parameter passed.
  But, when there is no parameter passed, the variable will be null on the page and this would lead to a Number Format Exception.

4. No Class Definition Exception

The exception shows in the bv logs
  The exception occurs when the class file corresponding to a java file is not present in the right path and you try to access the java class.
Make sure that the class file is present at the right path before trying to access the java file.
  One thing you need to take care is that when you make a very minor change to a java file and compile the file, the class file sometimes does not get replaced. You may need to physically delete the class and recompile.
  Once deleted, make sure you recompile successfully and that the class file is present.

Apart from these exceptions all other java errors will be thrown in the bv logs for the developer to identify.

This is a write up with the bare necessary things to get you started. There is a lot left to explore as you build on these basic steps.

Please feel free to consult any of your team members regarding any issues/doubts you may have.

Also on Fandom

Random wikia