-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Why does docker-compose log to STDERR for Building ....
instead of STDOUT when executing docker-compose build
#7346
Comments
Could it have something to do with this line: Line 65 in 13bacba
|
@shin- and everyone else STDOUT instead of STDERR I've been looking through some other Github issues and it seems that as of now this could be a choice made by the docker-compose team: To me the choice to (ab)use STDERR to split logging for docker and docker-compose seems like a wrong decision. StackExchange has some good information on how to use STDOUT and STDERR and I don't think docker-compose is complying to these standards: Let's see if the docker-compose team agrees on this as well and hopefully get this fixed as soon as possible. Some information on why this fix is important for me I'm currently parsing the logs of docker-compose but the best way to find out what build log belongs to what container is parsing through the log and finding the |
) It does the following: 1. Upgrades the base image versions of HttpStress and SslStress tests containers to `nightly/sdk:5.0` 2. Wraps over `docker-compose` call to prevent it from accidentally reporting progress to `stderr `instead of `stdout` and thus breaking CI pipeline (see docker/compose#7346)
…389) It does the following: 1. Upgrades the base image versions of HttpStress and SslStress tests containers to `nightly/sdk:5.0` 2. Wraps over `docker-compose` call to prevent it from accidentally reporting progress to `stderr `instead of `stdout` and thus breaking CI pipeline (see docker/compose#7346)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I just came across this issue, since we have a build process that alerts us when something is printed to stderr… we recently added |
This issue has been automatically marked as not stale anymore due to the recent activity. |
I agree that this is still an issue. Changing the log level does nothing to address writing output to STDERR. I run this in cron and utilize cronic (which is highly regarded in the linux world) to send emails when actual errors occur. This is my crontab:
The log level does nothing for me, so i get the following in my emails:
|
We are currently running into the same problem on our automatic deploy system. We have two solutions:
So we have nervous devs... Maybe it is possible to do some intelligent redirecting by scripted parsing? |
I have done something similar, redirected STDERR into a file, but then added a step into my pipe that will rely on an actual step failure to go and display the error log, I also added it as a step to display the error log on success pointing out that it contains these types of non error messages, then it was a matter of educating the devs about this. |
This is complete rubbish. Writing log messages to STDERR is poor practice. Fix it please, so we dont have to ignore our CI/CD messages. |
It has been an year since this issue was opened. Me as well as several other people are experiencing this issue, this is due to the fact that a large majority of users rely on Build Servers to build their changes. These Build Servers usually include the feature of interpreting output on |
At the very least, even if you have the worlds best argument for logging on STDERR, perhaps you could provide a flag, or argument in the docker-compose file for people who like logging to go elsewhere:
|
bump up |
Have been scratching my head why my script stopped working since I added docker-compose instead of docker run commands. I support the flag idea if the default behaviour is rather left untouched. |
Issue still exists |
Is there any update on this issue? |
Agree, writing non-errors to stderr is bad practice and breaks many standard workflows for checking and storing output. It's particularly bad as many docker-compose commands don't allow suppression of verbose output either. |
Bump up |
CD pipeline reports output messages from docker-compose as errors. Have to tell people that errors from docker-compose are normal messages and just ignore them. Please fix it. |
Add likes to first message. |
For us as well. At least let us configure it. |
+1 |
Any news on this? We are currently using Azure DevOps and we have to ignore the error messages due to this. |
I'm also not convinced use of os.stderr to display information on the current operation is not the best decision we made. |
Bump. The problem is still here. Logging to STDERROR is wrong on so many errors... |
For me (still using TFS2018) this somehow didn't work any more...what worked for me instead (using a windows agent and thus powershell) was the following: function Invoke-DockerComposeCommand {
param(
[string]
$arguments
)
$cmdarguments = @("/c", "docker-compose") + ($arguments -split " ")
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo
$processStartInfo.WorkingDirectory = (pwd).Path
$processStartInfo.FileName = "C:\windows\system32\cmd.exe"
$processStartInfo.RedirectStandardError = $true
$processStartInfo.RedirectStandardOutput = $true
$processStartInfo.UseShellExecute = $false
$processStartInfo.Arguments = $cmdarguments
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processStartInfo
Write-Host "docker-compose $arguments..." -NoNewline
$process.Start() | Out-Null
$process.WaitForExit()
if ($process.ExitCode -ne 0) {
Write-Host "error"
throw [Exception]::new("Error on docker-compose $($arguments): $($process.StandardError.ReadToEnd())")
}else{
Write-Host "done"
}
} Invoking it as following: Invoke-DockerComposeCommand "up -d" |
any workaround when using cronic? |
OK, I've been trying to get this to work (for a cron job), and noticed there are 2 cronic/chronic commands actually. I was trying to get it done using cronic, same as one user mentioned before, whereas the solution proposed here #5296 talks about chronic. There is a sutil difference here. |
Redirect "Creating * ... * "-messages from STDERR to STDOUT:
|
It appears that stdout to stderr was intentional. If there is a breaking reason, can you add a setting to not pipe stdout to stderr? Let the default be backwards compatible but also let anyone use stderr appropriately if we like. |
Signed-off-by: Tom Kerkhove <[email protected]>
I wrote handle_stderr() {
output=$($1 2>&1)
exit_code=$?
if [ $exit_code -eq 0 ]
then
echo "$output"
else
>&2 echo "$output"
exit $exit_code
fi
}
handle_stderr "docker compose pull"
handle_stderr "docker compose up --detach" |
Issue still exists. |
That's sad there's no such thing like a POSIX |
from this issues docker/compose#7346, we known the docker compose out all message in stderr instand of stdout
It seems the issue still exists with docker build e.g.
Assertions should be the other way around 🙃 |
@ton77v |
(Fixed by #10549 but not clear to see on this issue) |
Description of the issue
I'm working on an Azure DevOps extension which needs to read the docker-compose build output. I was however running into the issue that the STDOUT had some missing log lines: (Lines with #### in front of it where missing from STDOUT)
I've been doing some investigation and have created a repository to reproduce this:
https://github.com/devedse/STDOUTMissingError/blob/master/README.md
As you can see there, apparently the lines
Building ...
are being written to STDERR instead of STDOUT.Does anyone have any idea on why this is happening?
Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
See the repository linked above, I've added automated builds to that.
Steps to reproduce the issue
tsc
in the ./src directorynode index.js
in the ./src directory(Or simply check the build output in my repository)
Observed result
Expected result
Stacktrace / full error message
Well technically 😆:
But in fact, there's not really an error log.
Additional information
Happens on both linux (Travis-ci) and windows (Appveyor)
The text was updated successfully, but these errors were encountered: