Logging with whereabouts using open source and freeware

You can find the html version of this at:
http://www.acelet.com/whitepaper/loggingWithWhereabouts.html
Logging with whereabouts using open source and freeware
The purpose of logging is to find out what had happened when needed. When the
time comes to read log messages, you want to know both the log message and its
whereabouts (class name, method name, file name and line number). So you need
to hard code whereabouts.
But hard coded whereabouts are very difficult to maintain: when you modify your
source code, line number changes; when you copy and paste a line, its class name
and method name change. If whereabouts are wrong, you introduce bugs in your logging
logic and the log messages are useless at the best.
This article shows you an example of using freeware Redress tool to rectify whereabouts
programmatically in your Makefile or Ant build file. So your whereabouts are always
correct for both Java and JSP source file.
Redress tool is part of SuperLogging at http://www.ACElet.com. SuperLogging also
provides an open source wrapper Alog.java, which redirects log method calls to
your favorite logging package. Redress tool can rectify whereabouts information
on all Alog's method calls in your application. So, if you call Alog's log methods,
these calls will be rectified by Redress.
JDK 1.4 introduces a new utility package java.util.logging. The example in this
article is based on JDK logging. Log4J is a cousin of JDK logging. Log4J users
should have no difficulties to modify this example for Log4J. Both JDK logging
and Log4J are excellent logging software for single JVM.
Note: Redress tool rectifies method calls on Alog, not JDK logging. You need to
call Alog instead of JDK logging in your application.
Source code of Alog.java
The following is the source code of Alog's JDK logging version. It serves as an
library file and should be on your CLASSPATH:
* Copyright Acelet Corp. 2000. All rights reserved
* License agreement begins >>>>>>>>>> <br>
* This program (com.acelet.opensource.logging.Alog) ("Software") is an
* open source software. <p>
* LICENSE GRANT. The Software is owned by Acelet Corporation ("Acelet").
* The Software is licensed to you ("Licensee"). You are granted a
* non-exclusive right to use, modify, distribute the Software for either
* commercial or non-commercial use for free, as long as: <br>
* 1. this copyright paragraph remains with this file. <br>
* 2. this source code (this file) must be included with distributed
* binary code.<br>
* NO WARRANTY. This comes with absolutely no warranty. <p>
* <<<<<<<<<< License agreement ends <p><p>
* The purpose of releasing this open source program is to prevent vendor
* lock in. <p>
* You can code your program using this class to indirectly use Acelet
* SuperLogging (com.acelet.logging). If later you want to swith to other
* logging package, you do not need to modify your program. All you have
* to do is: <p>
* 1. modify this file to redirect to other logging packages. <br>
* 2. replace existing com.acelet.opensource.Alog with your modified one. <br>
* 3. you may have to reboot your EJB server to make the changes effect.<br>
* <p>
* This program is just a wrapper. For detail information about the methods
* see documents of underline package, such as com.acelet.logging.Logging.
* <p>
* Visit http://www.ACElet.com for more information.
* <p>
* This file is a modified for using JDK logging as an EXAMPLE.
* <br>
* You can use Redress tool to keep your whereabouts information
* always correct. See http://www.ACElet.com/freeware for detail.
* <p>
* Please see http://www/ACElet.com/opensource if you want to see the
* original version.
package com.acelet.opensource.logging;
import java.util.logging.*;
public final class Alog {
* Log level value: something will prevent normal program execution.
public static int SEVERE = 1000;
* Log level value: something has potential problems.
public static int WARNING = 900;
* Log level value: for significant messages.
public static int INFO = 800;
* Log level value: for config information in debugging.
public static int CONFIG = 700;
* Log level value: for information such as recoverable failures.
public static int FINE = 500;
* Log level value: for information about entering or returning a
* method, or throwing an exception.
public static int FINER = 400;
* Log level value: for detail tracing information.
public static int FINEST = 300;
static Logger logger;
static {
logger = Logger.getLogger("");
public Alog() {
public static void alert(String subject, String message) {
public static void error(String text, int level, String fullClassName,
String methodName, String baseFileName, int lineNumber) {
String[] para = {lineNumber + "", baseFileName};
logger.logp(getLevel(level), fullClassName, methodName, text, para);
public static Level getLevel(int levelValue) {
if (levelValue == SEVERE)
return Level.SEVERE;
else if (levelValue == WARNING)
return Level.WARNING;
else if (levelValue == INFO)
return Level.INFO;
else if (levelValue == CONFIG)
return Level.CONFIG;
else if (levelValue == FINE)
return Level.FINE;
else if (levelValue == FINER)
return Level.FINER;
else if (levelValue == FINEST)
return Level.FINEST;
else
return Level.ALL;
public static void log(String text, int level, String fullClassName,
String methodName, String baseFileName, int lineNumber) {
String[] para = {lineNumber + "", baseFileName};
logger.logp(getLevel(level), fullClassName, methodName, text, para);
public static void sendMail(String to, String from, String subject,
String text) throws Exception {
public static void sendMail(String to, String cc, String bcc, String from,
String subject, String text) throws Exception {
Test program
The simple test program is Test.java:
import com.acelet.opensource.logging.Alog;
public class Test {
public static void main(String argv[]){
Alog.log("Holle world", Alog.SEVERE, "wrongClassName", "wrongMethod",
"wrongFileName", -1);
How to run the test program
1. Compile Alog.java (JDK 1.4 or later, not before):
javac Alog.java
2. Download freeware Redress tool from http://ACElet.com/freeware.
3. Run Redress tool:
java -cp redress.jar Test.java
4. Check Test.java. The Alog.log method call should be rectified.
5. Run test program:
java Test
You should see log message with correct class name and method name.

Hi;
  I found this code and would like to share it with you :
JCoDestination destination = JCoDestinationManager
  .getDestination(DESTINATION_NAME2);
  JCoFunction function = destination.getRepository().getFunction(
  "RFC_FUNCTION_SEARCH");
  if (function == null)
  throw new RuntimeException("RFC_FUNCTION_SEARCH not found in SAP.");
  function.getImportParameterList().setValue("FUNCNAME", "*");
  function.getImportParameterList().setValue("GROUPNAME", "*");
  try {
  function.execute(destination);
  JCoTable funcDetailsTable = function.getTableParameterList()
  .getTable("FUNCTIONS");
  int totalNoFunc = funcDetailsTable.getNumRows();
  if (totalNoFunc > 0) {
  for (int i = 0; i < totalNoFunc; i++) {
  System.out.println("Function Name: "
  + funcDetailsTable.getValue(i));
  } catch (AbapException e) {
  System.out.println(e.toString());
  return;
  System.out.println("RFC_FUNCTION_SEARCH finished");
It is working and retrieving FM.
Regards
Anis

Similar Messages

  • Hello. I have a problem with OEL 6.5 and ocfs2. When I mount ocfs2 with mount -a command all ocfs2 partitions mount and work, but when I reboot no ocfs2 partitions auto mount. No error messages in log. I use DAS FC and iSCSI FC.

    Hello.
    I have a problem with OEL 6.5 and ocfs2.
    When I mount ocfs2 with mount -a command all ocfs2 partitions mount and work, but when I reboot no ocfs2 partitions auto mount. No error messages in log. I use DAS FC and iSCSI FC.
    fstab:
    UUID=32130a0b-2e15-4067-9e65-62b7b3e53c72 /some/4 ocfs2 _netdev,defaults 0 0
    #UUID=af522894-c51e-45d6-bce8-c0206322d7ab /some/9 ocfs2 _netdev,defaults 0 0
    UUID=1126b3d2-09aa-4be0-8826-0b2a590ab995 /some/3 ocfs2 _netdev,defaults 0 0
    #UUID=9ea9113d-edcf-47ca-9c64-c0d4e18149c1 /some/8 ocfs2 _netdev,defaults 0 0
    UUID=a368f830-0808-4832-b294-d2d1bf909813 /some/5 ocfs2 _netdev,defaults 0 0
    UUID=ee816860-5a95-493c-8559-9d528e557a6d /some/6 ocfs2 _netdev,defaults 0 0
    UUID=3f87634f-7dbf-46ba-a84c-e8606b40acfe /some/7 ocfs2 _netdev,defaults 0 0
    UUID=5def16d7-1f58-4691-9d46-f3fa72b74890 /some/1 ocfs2 _netdev,defaults 0 0
    UUID=0e682b5a-8d75-40d1-8983-fa39dd5a0e54 /some/2 ocfs2 _netdev,defaults 0 0

    What is the output of:
    # chkconfig --list o2cb
    # chkconfig --list ocfs2
    # cat /etc/ocfs2/cluster.conf

  • Help needed regarding some open source and good media streaming server

    Hi
    I am searching for some open source and java based media streaming server which can facilitate live video streaming. Can anyone please suggest me some good streaming server.
    Thank you.

    Some observations:
    (1) The use of the Configuration.createRootApplicationModule() API is recommended only for console programs, not web applications, but it should work ok as long as your use of the appliation module is completely stateless (which from the code it looks like it is since you release the AM back to the pool on each request.)
    (2) You mention "Stateful" mode, but Configuration.createRootApplicationModule() only supports stateless mode, so you are effectively using Stateless mode.
    (3) You are passing true as the 2nd argument to Configuration.releaseRootApplicationModule() which means you are asking to immediately remove the application module instance from the pool. This will hurt the scalability of your application since each request will need to be served by creating a brand new instance of the application module.
    (4) You are explicitly calling disconnect(). This is not necessary.
    I would recommend:
    (1) Changing your 2nd argument to releaseRootApplicationModule() to false
    (2) Remove the explicit call to disconnect()
    (3) Given your usage pattern, I'd recommend calling viewobject.setForwardOnly(true) before calling viewobject.executeQuery() and iterating over the results. This will avoid any caching of the fetched view object results. Also ensure you've read section "27.2 Tuning Your View Objects for Best Performance" of the ADF Developer's Guide for Forms/4GL Developers guide on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html for more performance tips
    For example, if you are fetching 65 rows, make sure the fetch size of this view object is at least 66 so you can retried all the rows in one DB roundtrip.

  • Can we do poduct costing with out using cost sheet  and overhead rates

    Hi,
    can we do product costing with out using cost sheets and overhead rates.
    In that cast , how the cost estimation happens ?

    Hi,
    a costing sheet is used to calculate (on a base) overhead values. If you dont need / want to use this functionality just create/use a costing variant where not costing sheet is assigned.
    Use this costing variant in CK11N or KKPAN, depending if ou have a quantity structure or not.
    best regards, Christian

  • HT204053 unable to log into iMatch using Apple Id and password.  Msg says i have valid Id for store but not iMatch.  What to do?

    unable to log into iMatch using Apple Id and password.  Msg says i have valid Id for store but not iMatch.  What to do?
    Is there a way to reset iMatch username and password?

    An Apple ID which consists of a non-Apple address can perfectly well be used to create and sign into an iCloud account (most Apple ID's take this form). Your problem is that you can't create an iCloud account on Windows: you can only do it on a Mac or an iOS device. Once created on one of those you can sign into it on Windows using the iCloud Control Panel.

  • How to use open cursor and iner join in one statement

    Hello All,
    Could any one post the code for the below question?
    How to use open cursor and iner join in one statement
    Regards,
    Lisa

    OPEN CURSOR c FOR SELECT     carrid connid fldate bookid smoker
                        FROM     sbook innerjoin shook
                        ORDER BY carrid connid fldate smoker bookid.
    Pls reward if helpful.

  • I have a VI A. I want A to call another VI B and execute. After B executes, I want it to close automatically and go back to A. Is this possible ? I tried using open reference and those methods, but I am not able to do it. Can someone help me ? Thanks !

    Thanks !
    Kudos always welcome for helpful posts

    Re: I have a VI A. I want A to call another VI B and execute. After B executes, I want it to close automatically and go back to A. Is this possible ? I tried using open reference and those methods, but I am not able to do it. Can someone help me ? Thanks !Hi Stephan ! Thanks ! I guess I explained my question not so right. I've created a customized menu and at the instance of me selecting a menu, a VI should load itself dynamically. I am using call by reference. Sometimes it works and sometimes it won't. In short, what I want to achieve is load VIs dynamically and close them dynamically once they finish executing. Thanks !
    Kudos always welcome for helpful posts

  • Best tutorial using open source technology with jdeveloper 11g for beginner

    Best tutorial based on Jdeveloper 11g myfaces, Spring , hibernate and oracle xe or mysql using tomcat server.
    Is there any tutorial like followed link. Using jdeveloper 11g.
    http://www.javaguicodexample.com/javawebjpajsfmysqldatabase12.html
    also like netbean tutorial in jdeveloper 11g.
    http://netbeans.org/kb/67/web/jastrologer-intro.html
    http://netbeans.org/kb/67/web/jastrologer-validate.html
    http://netbeans.org/kb/67/web/jastrologer-jsfformtags.html
    Jdeveloper 11g always go with wizard. I personally like visual jsf desinger of jdeveloper.
    But other thing i want to code. To understand properly.
    I am following following tutorial in jdeveloper 11g
    http://wowjava.wordpress.com/2010/01/21/jsf-database-application/
    Edited by: prafull on May 26, 2010 5:37 PM

    There isn't an end to end tutorial with the stack you are looking at, but:L
    You can start with this tutorial that uses EclipseLink for JPA to build the model layer:
    http://www.oracle.com/technology/obe/obe11jdev/ps1/ejb/ejb.html
    Here is a little example of how you can use Trinidad components (open source) in JDeveloper 11g for visual JSF development:
    http://blogs.oracle.com/shay/2009/02/using_trinidad_in_jdeveloper_1.html
    using MySQL would just mean adding the MySQL JDBC driver to JDeveloper, and to the integrated WebLogic - like this:
    http://jobinesh.blogspot.com/2009/06/adf-with-mysql.html

  • Adobe is simply a rip off and people should use open source programs

    Every time I go to use something you leaches are trying to suck more money from me.  I am moving everything to open source.  Screw you guys.

    Hi John,
    I'm so sorry to hear of your frustration. Is there something in particular I can assist you with?
    Please let me know.
    Looking foward to hearing back from you.
    Kind regards, Stacy

  • Open Source and Java Packages

    Ok. I'm creating an open source massively multiplayer role-playing game. A game, basically. Me and my team are trying to figure out what package to make the root. It was suggested that we use "org.fiverings" (Five Rings being the name of the game, for now), but we don't own the fiverings.org domain name. Now, one of our team has argued that if someone else buys that domain name, then we are invading their space, and could get into major legal issues.
    So how are we supposed to choose a root package name? Are there any conventions dealing with this? We're doing the project on SourceForge (you can get to the hosted page at <http://fiveringsrpg.sourceforge.net>), and so does that mean that we can extend SourceForge's package (like: net.sourceforge.fiveringsrpg)? Or, because we don't exactly own that domain, are we restricted?
    Thanks to any replies on conventions, and thanks to all that check out the game and post something in our non-Dev forum.

    for commercial projects it is common to use
    com.company.product....
    replace com with org/net or stateprefix if u wish.
    But you could also start with any other prefix. And you can always change this afterwards (if you use sth like Forte For Java then the IDE can handle this renaming of packages without changing code by hand).
    And I dont think, that when u use org.fiverings, that the owners of fiverings.org could put a legal on u.
    Christian

  • Using open source ADF

    Hi,
    does anyone know if the open source ADF can be used on a mysql database?
    And can I create graphs with the open source version of ADF?
    Regards Roel

    Hi Roel,
    Yes you can use MySQL with ADF Essentials.
    But lets not confuse free for open source. ADF Essentials is free, but not open source. I'm int he middle of writing a comprehensive how-to blog article on this, but you can piece it all together with these links below:
    1.) Download JDeveloper. I'm not sure if JDev 11.1.2.4 comes with ADF Essentials, but i know JDev 11.1.2.3 does. I used JDev 11.1.2.3 for my project.
    2.) Configure JDeveloper to run MySQL: http://jdev11g.blogspot.com/2009/04/oracle-jdeveloper-11g-with-mysql.html\
    3.) Install/Configure Glassfish with ADF Essentials: https://blogs.oracle.com/shay/entry/deploying_oracle_adf_applications_to and http://docs.oracle.com/cd/E35521_01/admin.111230/e16179/ap_glassfish.htm
    4.) Create a db connection to MySQL on JDev and make a small application - just use the normal ADF dev process to make some screens
    5.) Create JDBC MySQL Database Connection on Glassfish: http://mariosgaee.blogspot.com/2010/07/configure-mysql-connection-pool-in.html
    6.) Use Shay's blog in step 3 to deploy the application to glassfish
    7.) and Test!
    Thanks,
    Gavin
    http://www.pitss.com/us

  • Black screen on resume from sleep using open source AMD/ATI driver

    When waking from sleep using systemctl suspend or pm-suspend , I am presented with a black screen. I can still open programs, type, etc. but cannot see what I am doing. I usually just wind up rebooting from whatever terminal I had open, but again I can't see what I am typing. Upon reboot, the screen starts back up again. Everything else seems to resume from sleep just fine, it's just the screen that won't turn back on.
    I came from Ubuntu and had this same problem there. However, I only had this problem when using the open source xf86-video driver; when using the proprietary drivers, I was able to suspend/resume just fine. So it seems this problem is specific to the open source drivers.
    If I'm using an external monitor, my external monitor will resume just fine after waking from sleep, but the laptop screen will not.
    Googling around shows this is a common problem with AMD/ATI cards, and after a lot of attempts and failures I'm interested in knowing if anyone else has solved this problem.
    What I've tried so far (without success):
    -various quirks included with pm-utils to turn on dpms after resume
    -xrandr after resumption from sleep
    ==xrandr --output LVDS --off (If used without suspending (so while the screen still works) this seems to crash Gnome the first time around, but Gnome automatically restarts. If used a second time, it completely blanks the screen and requires a reboot)
    ==xrandr --output LVDS --mode 1600x900
    -xset dpms force on or xset dpms force off after resumption from sleep
    -vbetool dpms off and vbetool dpms on results in error message "Real mode call failed"
    -scripts using vbetool or xrandr when resuming from sleep
    -switching between virtual consoles and gnome using alt-ctrl-fn-f1 and alt-ctrl-fn-f2 keys
    My setup:
    -HP Envy dv7
    -UEFI dual-boot with Windows 8
    -AMD Radeon HD 7640G
    -xf86-video-ati 1:7.2.0-1 driver
    -Gnome DE using GDM login manager
    Thank you.
    EDIT: I did try using the proprietary drivers for a time, but found I couldn't adjust my brightness. At first I thought working suspension > adjustable brightness, but I quickly changed my mind after one night of trying to work on an unadjustable maximally bright screen.
    Last edited by broahmed (2013-11-23 02:18:57)

    Unfortunately I could not fix the problem so I wiped my system and loaded all new drivers before I found this posting.
    Is there a way to get the old ATI driver that works? The only one available on the ATI and Lenovo website is the latest one with the problem. I agree with you David, Lenovo should have fixed this problem already with ATI.
    John

  • How can I make a flash user interface with buttons to open up and navigate other flash files?

    Hello I would like to make a user interface that will serve as a tool to load and unload other flash materials like a slideshow. I would like to make a kind of slideshow with Flash that opens up other flash files which could be around 10-15 slides (frames) long each. I would want to ask if there is any way to make a link between navigation and other slides easily. And if there are ways, what action codes should I use for this. Thank you very much.

    All you need to do is load a swf into the main swf and target it with whatever controls you intend.  If you are using AS3 then you could use the Loader class to load the swf and then target the Loader.content with your control buttons.

  • Autherntication using Open Directory and NO home folder

    We are looking to set up an Open Directory on a Snow Leopard server in our medium sized company - we would like to use it for Single Sign On authentication but do not want to create home folders on the server. All we want OD to do is authenticate
    We have been able to authenticate using OD bound and unbound but both need home folders. Is there a way to have no home holder and still authenticate?
    thanks

    What I did was in WGM select a user account. Then select the Home tab. Click the + button to add a home folder. In the sheet that drops down, in the bottom box put /Users/username. Leave the other boxes blank. This will create a home folder locally on whatever machine the user logs into.

  • Until today(20.09) when i wanted to open an image on any website it opened, now it asks me with what to open it and it downloads it.

    Until today(20.09) when i wanted to open an image(like jpg,for exemple)on any website ,it did.Now it asks me with what program to open it and when im giving it , it first downloads it than opens it.I need to kno why and what to do to revert it to the way it was before.
    (Hope it wont take long until i wil get the answer...)

    # Type ''about:support'' in the address bar and press Enter.
    # Click the Show Folder button. This opens a Windows Explorer window with your profile folder.
    # Back in the Firefox window, click the ≡ Menu Button, then the Power Symbol to exit Firefox.
    # Back in the Windows Explorer window, right-click the ''mimeTypes.rdf'' file and choose Cut.
    # Right-click the desktop and choose Paste.
    # If the problem goes away when you next start Firefox, right-click the ''mimeTypes.rdf'' file on the desktop and choose Delete.
    # If the problem doesn't go away when you next start Firefox, check if you have the same issue with you start Firefox with add-ons disabled.
    #* [[Troubleshoot Firefox issues using Safe Mode]]

Maybe you are looking for