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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
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
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
Posts: 4
Registered: ‎10-12-2011
My Device: bold
My Carrier: airtel

Re: EventLogger events not showing in Simulator Event Log

hmmm...same  here wasted my time Smiley Happy