@@ -222,3 +222,40 @@ The general best practices are:
222
222
- Keep the versions aligned. If using a version range try to use the same version range everywhere.
223
223
- Declare first dependencies that use fixed version, not version ranges
224
224
- Use the ``conan graph info ... --format=html > graph.html `` graphical interactive output to understand and navigate conflicts.
225
+
226
+ .. _faq_stdout_stderr_redirects :
227
+
228
+ Conan is redirecting its output to stderr
229
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230
+
231
+ As explained :ref: `in the commands reference<commands_output> `,
232
+ by design Conan redirects its logging information to the standard error output (stderr),
233
+ while the actual results of the commands are sent to the standard output (stdout).
234
+
235
+ This is done to allow users to easily redirect the output of Conan commands to files or other
236
+ processes without having the logging information mixed with the actual results.
237
+
238
+ For example, running a command like:
239
+
240
+ .. code-block :: text
241
+
242
+ $ conan graph info --requires=zlib/1.3.1 --format=json > graph.json
243
+
244
+ ...
245
+
246
+ ======== Computing dependency graph ========
247
+ Graph root
248
+ cli
249
+ Requirements
250
+ zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76 - Cache
251
+
252
+ ======== Computing necessary packages ========
253
+ Connecting to remote 'conancenter' anonymously
254
+ Requirements
255
+ zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76:dbb40f41e6e9a5c4a9a1fd8d9e6ccf6d92676c92#8976086f07d37e3f6288e2fccf9650ae - Cache
256
+
257
+ will create a file named ``graph.json `` with the JSON output of the command, but it will not
258
+ include any logging information, which will be printed to the console.
259
+
260
+ Note that this approach is common in many command-line tools such as ``git `` and ``curl ``,
261
+ and it is not specific to Conan.
0 commit comments