Uncapped logging output

CircleCI changed the frontend recently, truncating build output more aggressively to improve performance. As you may or may not know, you can download raw logs for any build step, but that raw log is still capped to 4 MB. Some users have told us this has been an issue for them in debugging, so here’s a workaround in case you find yourself in this situation:

set -o pipefail && run_cmd | tee ~/cmd_full_output

cp ~/cmd_full_output $CIRCLE_ARTIFACTS

You’ll want to move those around your circle.yml as needed.

For the curious, here’s an explanation of the details:

set -o pipefail: Preserve/propagate failure exit codes, since we’re piping the output of whatever command into another. CircleCI relies on unix exit codes to decide if a build step succeeded or failed. This command is necessary to keep my builds marked as a CircleCI failure when a command fails.

tee some_file: Capture the output of the last command and send it to both the file and stdout. It’s still useful to see the output of the file on a build page, and CircleCi kills commands that run for 10 minutes without any output. I use tee instead of a unix pipe to preserve both behaviors.

cp $CIRCLE_ARTIFACTS: You can save just about any artifact from a build. Not much more to say there!

Hope this helps you in debugging your hairy problems! Please comment if you have any suggestions to improve this little hack.

4 Likes

Where is the logging output in osx?

I didn’t see anything in home, also searched for files ending with .log recursively (in home) and checked in system logs but couldn’t find anything.

syslog -C doesn’t contain anything relevant. Ran also history, there are no build commands. For context: getting commands must be a list error. Trying to find the reason.

Hey,

Could you please open a support ticket for this? I’d like to take a closer look at your builds in order to understand what information you’re looking for.

Thanks,
Constantin

I did, thanks. The issue I had is solved now (it was a syntax error in circle.yml). I was just interested in getting some orientation where to start looking at to find infos about the build, e.g. simply find the same text that is printed in the console in the Circle UI? I also wonder why there are not build or script commands when I enter history, is this executed by a different user or something?

Sorry for re-purposing this thread. It’s just not useful when I can’t find any logs :expressionless: should I open a new thread with these questions?

Hi Ian,

That text you see in the CircleCI UI is the result of multiple shell connections. Consider this yaml list:

test:
  pre:
    - command1
    - command2
    - command3 && command4 && history

command1 and command2 will run in independent shells. The user is the same, but the shell session is different. The last line will run 3 commands together, and some form of that should show up in history.

Hope this clears things up.

1 Like