You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "realMartinez (via GitHub)" <gi...@apache.org> on 2023/10/23 09:29:23 UTC

[PR] Feat: Set log level of a specific package using logging trait [camel-k]

realMartinez opened a new pull request, #4844:
URL: https://github.com/apache/camel-k/pull/4844

   <!-- Description -->
   - added capability to the logging trait to set log level of user specified package
   - added unit test
   
   
   _Usage:_
   ` -t "logging.category.'org.test'=DEBUG"`
   
   
   <!--
   Enter your extended release note in the below block. If the PR requires
   additional action from users switching to the new release, include the string
   "action required". If no release note is required, write "NONE". 
   
   You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
   the text is added to the right section of the release notes. 
   -->
   
   **Release Note**
   ```release-note
   NONE
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "realMartinez (via GitHub)" <gi...@apache.org>.
realMartinez commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1775211069

   > Great, good job! One more thing. We may provide an example inline with the new parameter as we do for route annotations.
   
   I amended the documentation to include CLI usage example


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1778838474

   @realMartinez I'm converting to a draft as I understand you're going to work on E2E test to validate the feature. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#discussion_r1368473714


##########
pkg/trait/logging_test.go:
##########
@@ -212,3 +213,31 @@ func TestJsonLoggingTrait(t *testing.T) {
 	assert.True(t, logFormatIsNotDefault)
 	assert.NotEmpty(t, env.ExecutedTraits)
 }
+
+func TestLoggingCategory(t *testing.T) {

Review Comment:
   Make another test to include 2 variables and make sure the 2 different packages are correctly transformed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "realMartinez (via GitHub)" <gi...@apache.org>.
realMartinez commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1964222348

   Need to close this PR, will link this to the new one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1807651550

   :camel: **Thank you for contributing!** :camel: 
   
     Unable to create **Coverage Report** :warning:. 
    Merge conflicts found.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "realMartinez (via GitHub)" <gi...@apache.org>.
realMartinez closed pull request #4844: feat: Set log level of a specific package using logging trait
URL: https://github.com/apache/camel-k/pull/4844


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Set log level of a specific package using logging trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#discussion_r1368470117


##########
pkg/trait/logging_test.go:
##########
@@ -212,3 +213,31 @@ func TestJsonLoggingTrait(t *testing.T) {
 	assert.True(t, logFormatIsNotDefault)
 	assert.NotEmpty(t, env.ExecutedTraits)
 }
+
+func TestLoggingCategory(t *testing.T) {
+	env := createLoggingTestEnv(t, true, true, false, "TRACE", "%d{HH:mm:ss} %-5p (%t) %s%e%n", map[string]string{})
+	env.Integration.Spec.Traits = v1.Traits{
+		Logging: &traitv1.LoggingTrait{
+			Category: map[string]string{"org.test": "debug"},
+		},
+	}
+
+	envVarQuarkusLogCategoryTestPackageName := "QUARKUS_LOG_CATEGORY_ORG_TEST_LEVEL"
+	envVarQuarkusLogCategoryTestPackageValue := "DEBUG"
+	quarkusOrgPackage := false
+
+	err := NewLoggingTestCatalog().apply(env)
+
+	assert.Nil(t, err)
+
+	for _, e := range env.EnvVars {
+		t.Log("Key:" + e.Name)
+		if e.Name == envVarQuarkusLogCategoryTestPackageName {
+			t.Log("Value: " + e.Value)
+			if e.Value == envVarQuarkusLogCategoryTestPackageValue {
+				quarkusOrgPackage = true
+			}
+		}
+	}
+	assert.True(t, quarkusOrgPackage)

Review Comment:
   Although this is correct, you better make use of `assert.Contains(t, array, val)`. You probably need to create an expected `corev1.EnvVar` with the key/value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "realMartinez (via GitHub)" <gi...@apache.org>.
realMartinez commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1775003825

   I generated the docs and also made the changes you requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1807643872

   :camel: **Thank you for contributing!** :camel: 
   
     Unable to create **Coverage Report** :warning:. 
    Merge conflicts found.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Set log level of a specific package using logging trait [camel-k]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4844:
URL: https://github.com/apache/camel-k/pull/4844#issuecomment-1937928042

   This PR has been automatically marked as stale due to 90 days of inactivity.
   It will be closed if no further activity occurs within 15 days.
   If you think that’s incorrect or the issue should never stale, please simply write any comment.
   Thanks for your contributions!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org