Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
jtyberg
Posts: 124
Registered: ‎09-06-2010
My Device: Not Specified
Accepted Solution

EventLogger events not showing in Simulator Event Log

So, I've been more than a little frustrated with debugging Widget apps and decided to help myself out a little.

 

I created a Widget extension that logs to System.out and the BB EventLogger using:

 

Logger.java:

public class Logger {

    public static final String APP_NAME = "AppName";
    public static final long GUID = 0xb50dd37e31148effL
;

    public static void enableLogging() {
        if (EventLogger.register(GUID, APP_NAME, EventLogger.VIEWER_STRING)) {
            out("Logger enabled.");
        }
        else {
            out("EventLogger registration failed.");
        }
    }


    /**
     * Prints to System.out and Event Log (if enabled).
     */
    public static void out(String msg) {
        String message = formatMessage(msg);
        System.out.println(message);
        log(message);
    }


    /**
     * Prints to Event Log with ALWAYS_LOG level.
     */
    public static void log(String msg) {
        logEvent(msg, EventLogger.ALWAYS_LOG);
    }

    private static void logEvent(String msg, int level) {
        if (EventLogger.logEvent(GUID, msg.getBytes(), level)) {
            System.out.println("EventLogger.logEvent succeeded.");
        }
        else {
            System.out.println("EventLogger.logEvent failed.");            
        }
    }
...
}

 

The Widget extension is working.  I can even log stuff from JavaScript:

 

somewhere in file.js:

Logger.log("this is from JavaScript!");

 

as seen by the Eclipse debug console:

 

AppName [2010-09-24 12:01:33.609]: Logger enabled.
EventLogger.logEvent succeeded.
AppName [2010-09-24 12:01:33.625]: this is from JavaScript!
EventLogger.logEvent succeeded.

 

RIDDLE ME THIS: WHY are the messages NOT being sent to the simulator Event Log!!!!!!!! (9550 or  9800 > Tools > Show Event Log does not show my messages.)

 

My frustration with BB is mounting.

 

-----

Windows XP 32-bit

Eclipse Version: 3.5.2, Build id: M20100211-1343

BlackBerry Web Plug-in Version:  2.0.0.201003191451-33

BlackBerry Java Plug-in Version:  1.1.2.201004161203-16

BlackBerry Java SDK Version:  5.0.0.25
BlackBerry Widget SDK Version:  1.0.0.201003191451-126

BlackBerry SmartPhone Simulator 6.0.0.141

Developer
jtyberg
Posts: 124
Registered: ‎09-06-2010
My Device: Not Specified

Re: EventLogger events not showing in Simulator Event Log

As a new BB developer, imagine my surprise when I found out that the BB EventLogger API and the BB simulator Event Log were completely unrelated.

 

It's like they're actually trying to confuse us.

New Contributor
damnsmart
Posts: 4
Registered: ‎10-12-2011
My Device: bold

Re: EventLogger events not showing in Simulator Event Log

hmmm...same  here wasted my time :smileyhappy: