Skip to content

Commit

Permalink
Fix 'azure-logging-0000' rule and test accordingly (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrizzi committed Apr 28, 2023
1 parent dbd8fe4 commit 592f923
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions rules/rules-reviewed/azure/azure-logging.windup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
<rule id="azure-logging-0000">
<when>
<or>
<filecontent filename="logback{*}.{extension}" pattern="{fileAppenderPattern}"/>
<filecontent filename="log4j{*}.{extension}" pattern="{fileAppenderPattern}"/>
<filecontent filename="log{4j,4j2}{*}.{extension}" pattern="{log4j2FileAppenderPattern}"/>
<filecontent filename="log{back,4j}{*}.{extension}" pattern="{filePattern}"/>
<javaclass references="org.apache.{*}log4j.{*}FileAppender{*}">
<location>IMPORT</location>
</javaclass>
Expand Down Expand Up @@ -54,19 +52,16 @@

Instead, use a console appender to log to standard output.
</message>
<link href=" http://aka.ms/spring-cloud-to-asa?toc=%2Fazure%2Fspring-apps%2Ftoc.json&amp;bc=%2Fazure%2Fspring-apps%2Fbreadcrumb%2Ftoc.json&amp;pivots=sc-standard-tier#ensure-console-logging-and-configure-diagnostic-settings" title="Enable console logging in migration"/>
<link href="https://aka.ms/spring-cloud-to-asa?toc=%2Fazure%2Fspring-apps%2Ftoc.json&amp;bc=%2Fazure%2Fspring-apps%2Fbreadcrumb%2Ftoc.json&amp;pivots=sc-standard-tier#ensure-console-logging-and-configure-diagnostic-settings" title="Enable console logging in migration"/>
<link href="https://learn.microsoft.com/azure/spring-apps/how-to-write-log-to-custom-persistent-storage" title="How to use Logback to write logs to custom persistent storage"/>
<tag>logging</tag>
</hint>
<technology-tag level="INFORMATIONAL">Logging to file system</technology-tag>
</perform>
</iteration>
</perform>
<where param="fileAppenderPattern">
<matches pattern="(?i)((Daily)?Rolling)?FileAppender"/>
</where>
<where param="log4j2FileAppenderPattern">
<matches pattern="(?i)(type\s*=\s*&quot;?((Daily)?Rolling)?File&quot;?)|&lt;\/((Daily)?Rolling)?File&gt;"/>
<where param="filePattern">
<matches pattern="(?i)((Daily)?Rolling)?FileAppender|type\s*=\s*((Daily)?Rolling)?File|&lt;\/((Daily)?Rolling)?File&gt;"/>
</where>
<where param="extension">
<matches pattern="(xml|properties)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<rule id="azure-logging-test-01000">
<when>
<not>
<iterable-filter size="9">
<iterable-filter size="12">
<hint-exists message="Logging to the file system is not recommended when running applications in the cloud." />
</iterable-filter>
</not>
Expand Down

0 comments on commit 592f923

Please sign in to comment.