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

Redirecting stdout/stderr from a Caplet #111

Open
muryoh opened this issue Jan 17, 2017 · 4 comments
Open

Redirecting stdout/stderr from a Caplet #111

muryoh opened this issue Jan 17, 2017 · 4 comments

Comments

@muryoh
Copy link

muryoh commented Jan 17, 2017

Hi,

My company is currently switching from a "custom app launcher" to a custom Caplet so that we can benefit from the standard bits (and Caplets) that Capsule brings.
One of our needs is being able to redirect the stdout and stderr of the capsule process in our Caplet.

Currently the logging is done through the STDOUT and STDERR variables which are initialized from the System.out and System.err variables.
This is the change that introduced this behavior: 5e08a99

Is there a reason/need for not manipulating the System.out and System.err variables directly? Would you consider a PR for doing so?

Cheers and thanks for reading

@pron
Copy link
Contributor

pron commented Jan 19, 2017

TBH, I don't recall at the moment why I made that change, so let me think about it. But I believe there are logs emitted even before caplets are loaded; won't those bother you? Also, can you explain the need? Why is redirecting the stdout/err on the command line insufficient?

@muryoh
Copy link
Author

muryoh commented Jan 20, 2017

Sure, thanks for the feedback

Basically we're making a caplet that is used to launch our applications without the need for a script
All the setup is done in a configuration file such as JVM params and product specific things which are set through system properties (legacy thing)
This includes stdout redirection, gc logs etc

@muryoh
Copy link
Author

muryoh commented Jan 20, 2017

I didn't check how early things are logged yet as I first wanted to know if you'd consider the change
But I can try it out and let you know

@pron
Copy link
Contributor

pron commented Jan 22, 2017

BTW, to override stdout/err in the application process (which, I think, is even more important to you), you'll need to do that by overriding the agent method, which is called by the capsule's agent's premain, before the application's classes are loaded.

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