PageSourceSearch

https://hydra.cc/assets/js/0169dbe1.9493da7a.js

js hydra.cc collected 2026-10-03 20:37:21 UTC 4,310 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[421],{75456(e,n,o){o.r(n),o.d(n,{assets:()=>g,contentTitle:()=>a,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"configure_hydra/logging","title":"Customizing logging","description":"Hydra is configuring Python standard logging library with the dictConfig method. You can learn more about it here.","source":"@site/versioned_docs/version-1.2/configure_hydra/logging.md","sourceDirName":"configure_hydra","slug":"/configure_hydra/logging","permalink":"/docs/1.2/configure_hydra/logging","draft":false,"unlisted":false,"editUrl":"https://github.com/hydra-ecosystem/hydra/edit/main/website/versioned_docs/version-1.2/configure_hydra/logging.md","tags":[],"version":"1.2","frontMatter":{"id":"logging","title":"Customizing logging","sidebar_label":"Customizing logging"},"sidebar":"docs","previous":{"title":"Job Configuration","permalink":"/docs/1.2/configure_hydra/job"},"next":{"title":"Customizing working directory pattern","permalink":"/docs/1.2/configure_hydra/workdir"}}');var i=o(94686),r=o(23629),s=o(75766);const l={id:"logging",title:"Customizing logging",sidebar_label:"Customizing logging"},a=void 0,g={},c=[];function d(e){const n={a:"a",code:"code",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.C,{text:"Example application",to:"examples/configure_hydra/logging"}
1),"\n",(0,i.jsxs)(n.p,{children:["Hydra is configuring Python standard logging library with the dictConfig method. You can learn more about it ",(0,i.jsx)(n.a,{href:"https://docs.python.org/3/howto/logging.html",children:"here"}),".\nThere are two logging configurations, one for Hydra itself and one for the executed jobs."]}),"\n",(0,i.jsx)(n.p,{children:"This example demonstrates how to customize the logging behavior of your Hydra app, by making the following changes\nto the default logging behavior:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Outputs only to stdout (no log file)"}),"\n",(0,i.jsx)(n.li,{children:"Output a simpler log line pattern"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",metastring:'title="config.yaml"',children:"defaults:\n  - override hydra/job_logging: custom\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",metastring:'title="hydra/job_logging/custom.yaml"',children:"version: 1\nformatters:\n  simple:\n    format: '[%(levelname)s] - %(message)s'\nhandlers:\n  console:\n    class: logging.StreamHandler\n    formatter: simple\n    stream: ext://sys.stdout\nroot:\n  handlers: [console]\n\ndisable_existing_loggers: false\n"})}),"\n",(0,i.jsx)(n.p,{children:"This is what the default logging looks like:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"$ python my_app.py hydra/job_logging=default\n[2020-08-24 13:43:26,761][__main__][INFO] - Info level message\n"})}),"\n",(0,i.jsx)(n.p,{children:"And this is what the custom logging looks like:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"$ python my_app.py \n[INFO] - Info level message\n"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},75766(e,n,o){o.d(n,{A:()=>a,C:()=>g});o(92990);var t=o(88512),i=o(81928),r=o(91471),s=o(94686);function l(e){var n;const o=(0,r.ir)();return(0,i.A)().siteConfig.customFields.githubLinkVersionToBaseUrl[null!=(n=null==o?void 0:o.name)?n:"current"]+e}function a(e){return(0,s.jsx)(t.A,Object.assign({},e,{to:l(e.to),target:"_blank"}))}function g(e){var n;const o=null!=(n=e.text)?n:"Example (Click Here)";return(0,s.jsxs)(a,Object.assign({},e,{children:[(0,s.jsx)("span",{children:"\xa0"}),(0,s.jsx)("img",{src:"https://img.shields.io/badge/-"+o+"-informational",alt:"Example (Click Here)"})]}))}},23629(e,n,o){o.d(n,{R:()=>s,x:()=>l});var t=o(92990);const i={},r=t.createContext(i);function s(e){const n=t.useContext(r);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.