Open Koushikgudipati opened 3 years ago
@Koushikgudipati did you ever resolve this? I'm running into the same issue as well.
Update: after some digging, I discovered that when you call logger.info(...)
or say logger.error(...)
the logger object itself servers as a filter because it has a level associated with it.
I discovered that the logger object's default level is set to WARNING. You can check this by printing out the current level with this statement:
print(logger.getEffectiveLevel())
You will see it output the value 30 which maps to WARNING (see enum levels below). What this means is that any log message with the level of anything higher than or equal to a warning (30) gets the go-ahead to move on.
CRITICAL = 50 FATAL = CRITICAL ERROR = 40 WARNING = 30 # right now anything lower than this won't pass through. WARN = WARNING INFO = 20 DEBUG = 10 NOTSET = 0
So what we have to do is set the level (change the filter) to which we will allow messages to carry through. We can do this by adding this line after calling logging.getLogger(...):
logger.setLevel(logging.DEBUG)
Now check the logger current level print(logger.getEffectiveLevel())
and you will see the value 10. This means that any log with a level of 10 or higher will pass through. You should now see debug and info logs going to Loki.
gatlee21 This is awsome! Thanks so much for sharing, can i ask you where have you been digging to find this out? So i can do the same!
2024 and anyone resolved this problem, I got the same issue on Python, this is a foolish bug :d
I am trying to push logs to loki.
When pushing logs with log level info , I do not see any logs going to loki .also it does not throw any error as well. When i use log level as error/warn i can logs pushed to loki.
Do i need to make any change to send info log level logs to info loki?
Also i have used