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

UA_LOGLEVEL is set to 100 but not seeing Trace and Debug in the log #5991

Open
2 of 7 tasks
tukotech opened this issue Sep 1, 2023 · 3 comments
Open
2 of 7 tasks

Comments

@tukotech
Copy link

tukotech commented Sep 1, 2023

UA_LOGLEVEL is set to 100 but not seeing Trace and Debug - I can see INFO/WARN/ERROR.

Background Information / Reproduction Steps

I can step through the debugger and see that TRACE and ERROR logs are hit but I am not seeing the text in the console.

Used CMake options:

cmake -DUA_NAMESPACE_ZERO=FULL -DUA_MULTITHREADING=100 -DCMAKE_BUILD_TYPE=Debug -DUA_ENABLE_PUBSUB=ON -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_MQTT=ON -DUA_ENABLE_PUBSUB_MONITORING=ON -DUA_LOGLEVEL=100 -DUA_ENABLE_JSON_ENCODING=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON ..

Checklist

Please provide the following information:

  • open62541 Version (release number or git tag): master
  • Other OPC UA SDKs used (client or server):
  • Operating system: Ubuntu 23.04
  • Logs (with UA_LOGLEVEL set as low as necessary) attached
  • Wireshark network dump attached
  • Self-contained code example attached
  • Critical issue
@tukotech
Copy link
Author

tukotech commented Sep 1, 2023

I added the following to examples/pubsub/tutorial_pubsub_mqtt_subscribe.c and now I can see debug logs. Is this expected?

    UA_Server *server = UA_Server_new();
    UA_ServerConfig *config = UA_Server_getConfig(server);
    config->logger = UA_Log_Stdout_withLevel( (UA_LogLevel)100 );

@neojaw
Copy link
Contributor

neojaw commented Sep 1, 2023

I guess it is. The UA_LOGLEVEL compile option controls what log messages are generated at all, but the logging plugin (The Stdout logger is the default logging plugin) can still decide which ones to actually show / record etc. In the default server config, the logger is set as UA_Log_Stdout_withLevel(UA_LOGLEVEL_INFO), so it will only print Info messages and upward.

However, I'm a bit confused why your use of 100 works here, I think you are supposed to use the actual enum constants (UA_LOGLEVEL_*) which are, as integers, way smaller than 100. You can take a look at examples/server_loglevel.c for an example.

@tukotech
Copy link
Author

tukotech commented Sep 2, 2023

RE: You can take a look at examples/server_loglevel.c for an example
Yes, that's where I learned about UA_Log_Stdout_withLevel. The level was coming from command line argument, link below was the source of inspiration.

https://github.com/open62541/open62541/blob/3ad448ec722087a369c8b2c94391dfe944679ed4/examples/server_loglevel.c#L38C1-L38C63

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

2 participants