Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roc.DefaultConnection log level #3

Open
vdeters opened this issue Jul 26, 2019 · 3 comments
Open

roc.DefaultConnection log level #3

vdeters opened this issue Jul 26, 2019 · 3 comments

Comments

@vdeters
Copy link

vdeters commented Jul 26, 2019

Hello, I'm seeing log messages like this:

Jul 26, 2019 4:19:10 PM rpc.DefaultConnection processOutgoing
INFO:
Sending REQUEST

...how can I control this log level? I have found these methods:

JISystem.setInBuiltLogHandler(false);
JISystem.getLogger().setLevel();

...but how can I get the JISystem instance?

Thanks!

@MiniPlayer
Copy link
Contributor

MiniPlayer commented Jul 29, 2019

Hello,
What version are you using ? The best way to change log level in an application is to use a configuration file. We are using slf4j as you can see in the pom file :

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.12</version>
        </dependency>

Maybe you will have to add an implementation of slf4j as indicated in their documentation https://www.slf4j.org/docs.html
In test we added this dependency

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
            <scope>test</scope>
        </dependency>

Then in test you should be able to use log config file of logback.

May I ask why are you using our library ? What is your use case ? Maybe we can help you to achieve what you are trying to do ?

@amarziali amarziali mentioned this issue Aug 17, 2022
@amarziali
Copy link
Contributor

👋 Hi. The PR mentioned above shows an example of how to control what is logged by the opc-da subsystem.

TL;DR
jInterop uses java.util.logging. In order to make it working with slf4j you need to bridge it. First you need to declare the dependency for the bridge

<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>1.7.36</version>
            <scope>runtime</scope>
        </dependency>

The statically init it:

static {
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();
    }

Then configure the logger level as usual.

Best,

Andrea

@duduyoyo
Copy link

J-Interop can't work properly after Microsoft applied DCOM hardening. You can check link here on this issue.

Alternatively, you can try this solution to retrieve OPC data back in Java. It utilizes network transportation layer to access data, so there is no 3rd party Java library or SDK required. IMO, it is simple and straightforward. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants