-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Is that possible to config log destination to stdout in container environment #795
Comments
@sczyh30 @cdfive @CarpenterLee We can figure out whether a configurable option should be introduced to register a different log handler to Btw, though there is already a similar handler |
Yes, it might be necessary to do this. There's another discussion here: #757 BTW, there are also metrics log and |
In this scenario More opinions? @CarpenterLee @cdfive |
More on supporting common interface (eg. slf4j-api) again we can introduce a dependency with |
I'm agree with that it's necessary to support log to stdout and make it configurable.
@jasonjoo2010 I also find that in public static class MyConsoleHandler extends ConsoleHandler {
public MyConsoleHandler() {
super();
setOutputStream(System.out);
}
} Use that Handler, we can print the log to stdout.
In container env, it distinguishes these two, or only stdout? How about adding a config parameter like csp.sentinel.log.stdout=true?
@sczyh30 Does it means that the logging interface are used three kinds of logs? |
Generally both of them can be collected and can be treated differently. So it's better to obey the real meaning of Using |
The logging interface is for common log (e.g.
We can support the console log if necessary. Any other suggestions? Do you think it's necessary to abstract the logging SPI? @cdfive @CarpenterLee |
How about just making the |
Actually i think we should consider two scenarios:
So i suggest that why we consider it as a single PR? We can divide it into two PRs and maybe make more discussions or someone else take charge on the SPI one. |
Yes, it can be divided into separate PRs. For logging SPI if someone has a good design we could discuss here: #757 |
It seems we reach to a common sense on separating it and who is willing to contribute the first one? (Console output) @cdfive Are you willing to? /::D |
Seem like everybody busy so i will take charge on it. And see alibaba/spring-cloud-alibaba#707 Not only actual users but also SCA does more duplicated things(loading test, validation etc.) which already exists in sentinel-core. The main reason i think is still the logging related. Because they(SCA) want output some obvious content to indicate whether there was any problem when initializing sentinel module. According this i think i still will make them (Console & SPI) in single PR. What's your opinion, @sczyh30 ? |
@jasonjoo2010 I'd like to try, but I've been very busy with my work recently, hope it will be better next month. Besides I haven't a clear idea at the moment about it. Are there any good resources for learning to solve this? |
And the formal i imagined as: sentinel-core If we only have sentinel-core in our project the logging is remain just as what it does now. But if we want it directed into console(err, out) we just introduce an additional dependency That will solve all the problems we meet currently. The core concept in SPI is a file will be placed into |
@jasonjoo2010 Thanks detailed description. Are three log modules too many? How about only one log module, which can be used easily. Besides I'm not sure about if a log module is needed.Can we refer the way to support log some other projects does? |
The point is, we should consider carefully introducing new configuration item, less configuration and more simple. On the other hand using SPI mechanism we give a possibility to our users making their own implementations. After all it's difficult to make everyone feel satisfied, isn't it? Finally i just think it will be more simple and clearer for us to make new modules or am i missing something? And we generally can keep the most code by this way in sentinel-core and put new codes into new modules separately. |
Agree with it. For simply solve this issue mentioned, I post a PR, which simply add a option to support log the common log to console, PTAL. @jasonjoo2010 @sczyh30
Yes, obey the meaning is better, but for simple maybe stdout is enough. Besides, I found that the level of log in And for abstract logging SPI support, it maybe complicated and we can divide another PR. |
Yes agree with your last words. But I still suggest to separate logs into stderr and stdout for obvious meaning expression. And can you give some suggestions on it, @sczyh30 ? PS: I found it hardly quoting the wrong name again if I use |
@jasonjoo2010 I add To print logs separate into stderr and stdout, I tried and found a way, I'll post it later. |
Support separate logs into stderr and stdout is added. Besides, the System.err log in IDE console is red font, while the System.out is white. |
I think that's ok and if users want to merge them they could redirect stderr into stdout simply.
Currently some integrating like |
This is a good thought. So for common logs, maybe it's enough, hope it will solve the desire this issue mentioned. For logging SPI, I haven't much experiences and expecting for your more ideas. Maybe we can refer other project like Dubbo. |
Never mind we can finish the first PR. |
For further discussion of the logging interface, we could discuss here: #757 |
…/en/ (alibaba#795) * To add the English version of Examples of Ordered Messages in docs/en/ * Format the style using MD gramma.
Issue Description
Type: feature request
Describe what happened (or what feature you want)
In container environment, we desire output log to stdout, so that we can collection log with EFK, but I cannot find a config option
Describe what you expected to happen
Output log to stdout
How to reproduce it (as minimally and precisely as possible)
Tell us your environment
Kubernetes
Anything else we need to know?
The text was updated successfully, but these errors were encountered: