# Disallow use of System.out.println and System.err.println

**URL:** <https://community.sonarsource.com/t/disallow-use-of-system-out-println-and-system-err-println/18944>\
**Category:** New rules / language support\
**Tags:** java\
**Created:** [January 18, 2020, 1:10am UTC](https://community.sonarsource.com/t/disallow-use-of-system-out-println-and-system-err-println/18944 "2020-01-18T01:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![romack](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@romack](https://community.sonarsource.com/u/romack)\
**Post date:** [January 18, 2020, 1:10am UTC](https://community.sonarsource.com/t/disallow-use-of-system-out-println-and-system-err-println/18944/1 "2020-01-18T01:10:41Z")

</div>

- description of the Rule  
Should use a logger instead so that a log level can be specified, log verbosity can be controlled or completely suppressed using the log configuration.

- snippet of Noncompliant Code

```auto
    public void doSomething() {
        System.out.println("Doing Something...");
    }

```

- snippet of Compilant Code (fixing the above noncompliant code)

```auto
    public void someSomething() {
        LOGGER.debug("Doing Something...");
    }

```

- external references and/or language specifications
- type : Code Smell
- tags . java, codesmell

---

<div class="post-metadata">

**Author:** ![CrushaKRool](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/crushakrool/32/6541_2.png) [@CrushaKRool](https://community.sonarsource.com/u/CrushaKRool)\
**Post date:** [January 18, 2020, 10:29am UTC](https://community.sonarsource.com/t/disallow-use-of-system-out-println-and-system-err-println/18944/2 "2020-01-18T10:29:04Z")

</div>

Such a rule already exists:  
[https://rules.sonarsource.com/java/RSPEC-106](https://rules.sonarsource.com/java/RSPEC-106)
