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

The environment variable "CYGNUS_LOG_LEVEL" does not work #2286

Closed
ctc-watanabe opened this issue Aug 21, 2023 · 5 comments
Closed

The environment variable "CYGNUS_LOG_LEVEL" does not work #2286

ctc-watanabe opened this issue Aug 21, 2023 · 5 comments

Comments

@ctc-watanabe
Copy link

Hi, I have a question about the log settings for Cygnus version 3.

It seems that the "CYGNUS_LOG_LEVEL" environment variable is not working for Cygnus version 3.

version: "3"

services:
  orion:
    container_name: orion
    image: fiware/orion:3.7.0
    links:
      - mongo
    ports:
      - "1026:1026"
    command: -dbhost mongo -logLevel DEBUG

  cygnus:
    container_name: cygnus
    # image: fiware/cygnus-ngsi:2.20.0
    image: fiware/cygnus-ngsi:3.2.0
    links:
      - mongo
    expose:
      - "5080"
    ports:
      - "5051:5051"
      - "5080:5080"
    environment:
      - CYGNUS_MONGO_HOSTS=mongo:27017
      - CYGNUS_API_PORT=5080
      - CYGNUS_SERVICE_PORT=5051
      - CYGNUS_MONGO_SERVICE_PORT=5051
      - CYGNUS_LOG_LEVEL=DEBUG

  mongo:
    container_name: mongo
    image: mongo:4.4

When "DEBUG" is set to "CYGNUS_LOG_LEVEL" in the above configuration, the DEBUG log is not output and only the WARN log is output.

If the image used is switched to "fiware/cygnus-ngsi:2.20.0", the DEBUG log is output.

Please let me know if there is any mistake in the settings.

Thank you in advance.

@AlvaroVega
Copy link
Member

When cygnus starts you can change log level using API:
curl -i -X PUT 'http://localhost:5080/admin/log?level=DEBUG'

@ctc-watanabe
Copy link
Author

@AlvaroVega
Thank you for your comment.

I understand how to change the log level using the API.
Are you saying that it is not possible to set the log level at startup using environment variables as in version 2?

@AlvaroVega
Copy link
Member

Are you saying that it is not possible to set the log level at startup using environment variables as in version 2?

I reckon there is a bug

@fgalan
Copy link
Member

fgalan commented Aug 22, 2023

Fixed by PR #2287

@ctc-watanabe could you test (using the telefonicaiot/fiware-cygnus:latest container) to check if it works and report in this issue, please?

@ctc-watanabe
Copy link
Author

@AlvaroVega
@fgalan
Thank you for your quick response!
I confirmed that DEBUG logs are output using the following yaml.

version: "3"

services:
  orion:
    container_name: orion
    image: fiware/orion:3.7.0
    links:
      - mongo
    ports:
      - "1026:1026"
    command: -dbhost mongo -logLevel DEBUG

  cygnus:
    container_name: cygnus
    image: telefonicaiot/fiware-cygnus:latest
    links:
      - mongo
    expose:
      - "5080"
    ports:
      - "5051:5051"
      - "5080:5080"
    environment:
      - CYGNUS_MONGO_HOSTS=mongo:27017
      - CYGNUS_API_PORT=5080
      - CYGNUS_SERVICE_PORT=5051
      - CYGNUS_MONGO_SERVICE_PORT=5051
      - CYGNUS_LOG_LEVEL=DEBUG

  sth:
    container_name: sth
    image: fiware/sth-comet:2.10.0
    depends_on:
      - "mongo"
    links:
      - mongo
    ports:
      - "8666:8666"
    environment:
      - STH_HOST=0.0.0.0
      - DB_URI=mongo:27017

  mongo:
    container_name: mongo
    image: mongo:4.4

The log is as follows:

INFO: Using JAVA_OPTS: <-Xms2048m -Xmx4096m>
Warning: JAVA_HOME is not set!
+ exec /usr/bin/java -Xms2048m -Xmx4096m -Dflume.root.logger=DEBUG,LOGFILE -Duser.timezone=UTC -Dfile.encoding=UTF-8 -cp '/opt/apache-flume/conf:/opt/apache-flume/lib/*:/opt/apache-flume/plugins.d/cygnus/lib/*:/opt/apache-flume/plugins.d/cygnus/libext/*' -Djava.library.path= com.telefonica.iot.cygnus.nodes.CygnusApplication -f /opt/apache-flume/conf/agent.conf -n cygnus-ngsi -p 5080
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/apache-flume/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-flume/plugins.d/cygnus/lib/cygnus-ngsi-3.2.0-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-flume/plugins.d/cygnus/libext/cygnus-common-3.2.0-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
time=2023-08-23T12:13:40.990Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mysql-sink.mysql_username = 
time=2023-08-23T12:13:41.016Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.orion-sink.orion_fiware = 
time=2023-08-23T12:13:41.018Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.sth-sink.mongo_password = 
time=2023-08-23T12:13:41.020Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mongo-sink.mongo_username = 
time=2023-08-23T12:13:41.021Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.arcgis-sink.arcgis_password = 
time=2023-08-23T12:13:41.022Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.sth-sink.mongo_auth_source = 
time=2023-08-23T12:13:41.024Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.postgis-sink.postgis_username = 
time=2023-08-23T12:13:41.025Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.arcgis-sink.arcgis_username = 
time=2023-08-23T12:13:41.026Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mongo-sink.mongo_replica_set = 
time=2023-08-23T12:13:41.028Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.hdfs-sink.hdfs_username = 
time=2023-08-23T12:13:41.030Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.ckan-sink.api_key = 
time=2023-08-23T12:13:41.031Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.postgis-sink.postgis_password = 
time=2023-08-23T12:13:41.033Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mongo-sink.mongo_password = 
time=2023-08-23T12:13:41.034Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.hdfs-sink.oauth2_token = 
time=2023-08-23T12:13:41.035Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.orion-sink.orion_fiware_path = 
time=2023-08-23T12:13:41.036Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.postgresql-sink.postgresql_username = 
time=2023-08-23T12:13:41.038Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mongo-sink.mongo_auth_source = 
time=2023-08-23T12:13:41.039Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.orion-sink.orion_password = 
time=2023-08-23T12:13:41.041Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.sth-sink.mongo_username = 
time=2023-08-23T12:13:41.043Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.sth-sink.mongo_replica_set = 
time=2023-08-23T12:13:41.045Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.mysql-sink.mysql_password = 
time=2023-08-23T12:13:41.046Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.postgresql-sink.postgresql_password = 
time=2023-08-23T12:13:41.048Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=<init> | msg=org.apache.flume.conf.FlumeConfiguration[126] : Configuration property ignored: cygnus-ngsi.sinks.orion-sink.orion_username = 
time=2023-08-23T12:13:41.050Z | lvl=WARN | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=N/A | op=validateConfigFilterSet | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[623] : Agent configuration for 'cygnus-ngsi' has no configfilters.
time=2023-08-23T12:13:42.549Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp= | op=checkPathsWithUncoveredHttpMethods | msg=org.eclipse.jetty.security.ConstraintSecurityHandler[759] : ServletContext@o.e.j.s.ServletContextHandler@1eb483f5{/,null,STARTING} has uncovered http methods for path: /*
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
time=2023-08-23T12:13:48.194Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=putLogLevel | msg=com.telefonica.iot.cygnus.management.LogHandlers[1107] : log4j logging level updated to DEBUG
{"success":"log4j logging level updated to DEBUG" }
100    52  100    52    0     0    406      0 --:--:-- --:--:-- --:--:--   406
time=2023-08-23T12:13:48.217Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=debug | msg=org.mortbay.log.Slf4jLog[40] : EOF
time=2023-08-23T12:14:11.920Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:14:11.883Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:14:11.920Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=run | msg=org.apache.flume.node.UriConfigurationProvider$WatcherRunnable[339] : Checking for changes to sources
time=2023-08-23T12:14:11.926Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=isModified | msg=org.apache.flume.node.FileConfigurationSource[77] : Checking file:/opt/apache-flume/conf/agent.conf for changes
time=2023-08-23T12:14:12.071Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=run | msg=com.telefonica.iot.cygnus.interceptors.NGSINameMappingsInterceptor$PeriodicalNameMappingsReader[214] : [nmi] The configuration has not changed
time=2023-08-23T12:14:41.930Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=run | msg=org.apache.flume.node.UriConfigurationProvider$WatcherRunnable[339] : Checking for changes to sources
time=2023-08-23T12:14:41.931Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=isModified | msg=org.apache.flume.node.FileConfigurationSource[77] : Checking file:/opt/apache-flume/conf/agent.conf for changes
time=2023-08-23T12:14:41.946Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:14:41.946Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:14:42.077Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=run | msg=com.telefonica.iot.cygnus.interceptors.NGSINameMappingsInterceptor$PeriodicalNameMappingsReader[214] : [nmi] The configuration has not changed
time=2023-08-23T12:15:11.939Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=run | msg=org.apache.flume.node.UriConfigurationProvider$WatcherRunnable[339] : Checking for changes to sources
time=2023-08-23T12:15:11.942Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=isModified | msg=org.apache.flume.node.FileConfigurationSource[77] : Checking file:/opt/apache-flume/conf/agent.conf for changes
time=2023-08-23T12:15:11.983Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:15:11.986Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=processNewBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[515] : Batch accumulation time reached, the batch will be processed as it is
time=2023-08-23T12:15:12.085Z | lvl=DEBUG | corr=N/A | trans=N/A | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=run | msg=com.telefonica.iot.cygnus.interceptors.NGSINameMappingsInterceptor$PeriodicalNameMappingsReader[214] : [nmi] The configuration has not changed
time=2023-08-23T12:15:41.948Z | lvl=DEBUG | corr= | trans= | srv= | subsrv= | comp= | op=run | msg=org.apache.flume.node.UriConfigurationProvider$WatcherRunnable[339] : Checking for changes to sources
...

I look forward to the next update.

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

3 participants