user38903
user38903

Reputation: 43

Debugging a JLink application in Pro-Engineer

I'm trying to use J-Link, the Java language toolkit for Pro-Engineer.

I haven't yet found a way to debug or trace through J-Link applications, something that I need to do to understand the sample applications.

The manual recommends attaching a debugger to the the process that was started by Pro-Engineer, which doesn't seem to be working for me.

Any other suggestions/recommendations?

Upvotes: 0

Views: 1590

Answers (2)

n'zar
n'zar

Reputation: 1

I have set the record in my config.pro like this:

jlink_java_command C:\Program Files\Java\jdk1.8.0_74\bin\java.exe -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Then in Netbeans attached debugger (note the application should already be running in pro/e or creo environment) and this works for me.

Upvotes: 0

KLMN
KLMN

Reputation: 559

Hi I'm using log4j, it's very easy to use.

First, download log4j jar file at http://logging.apache.org/log4j/1.2/download.html and you can find many many sample code for how to use log4j.

Here is my code:

static final Category log = Category.getInstance(TestUtil.class);
static final String LOG_PROPERTIES_FILE = "log4j.properties";
private static boolean isInit = false;

public static void initializeLogger() {
    if (!isInit) {
        PropertyConfigurator.configureAndWatch(LOG_PROPERTIES_FILE);
        isInit = true;
        log.debug("log initial successed!");
    }
}

in protk.dat, add java_app_classpath to add log4j's jar file path:

name     StartInstallTest
startup  java
java_app_class  StartInstallTest
java_app_start  start
java_app_stop   stop
java_app_classpath  <proe root>\text\java\pfc.jar;<proe root>\text\java\log4j-1.2.16.jar;.
allow_stop      true
delay_start     false
text_dir        ./text
end

in log4j.properties:

log4j.rootLogger=DEBUG, A2
log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=[%d{HH:mm:ss:SSS}][%C-%M] %m%n
log4j.appender.A2.File=c:/log/jlink_test.log

Upvotes: 1

Related Questions