You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/24 23:07:50 UTC

[GitHub] [camel-k] Gre8t opened a new pull request, #3231: added logging traits documentation.

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

   <!-- Description -->
   
   The logging traits needed a documentation. This fixes issue #3143 
   
   
   <!--
   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


[GitHub] [camel-k] squakez commented on a diff in pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
squakez commented on code in PR #3231:
URL: https://github.com/apache/camel-k/pull/3231#discussion_r859855770


##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $ kamel run logging.java

Review Comment:
   Logging with L uppercase...



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $ kamel run logging.java
+
+     $ kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $ kubectl get pods
+
+     $ kubecttl logs <pod name>
+
+You can configure the log output with the `logging traits` flag:
+      
+Property | Type | Description 
+---|---|---  
+logging.enabled | boolean| We can set to false to disable logging
+logging.color | boolean| makes logging output colorful. This makes skimming through the logs easier.
+logging.json | boolean | Makes logs output to be in json format. We can use tools like `jq` to manipulate output.
+logging.json-pretty-print | boolean | It's like using an in built `jq` to print our json output.
+logging.level | string | This is just a verbosity level settings. We can just use `info`
+
+for more traits options see this [Link.](https://camel.apache.org/camel-k/next/traits/logging.html).
+
+manual log setting example using  `logging trait`:
+     
+     $ kamel run ./logging.java --trait logging.enabled=true --trait logging.json=true --trait logging.level=info

Review Comment:
   Logging with L



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $ kamel run logging.java
+
+     $ kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $ kubectl get pods
+
+     $ kubecttl logs <pod name>

Review Comment:
   Probably `kubectl`



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $ kamel run logging.java
+
+     $ kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $ kubectl get pods
+
+     $ kubecttl logs <pod name>
+
+You can configure the log output with the `logging traits` flag:
+      
+Property | Type | Description 
+---|---|---  
+logging.enabled | boolean| We can set to false to disable logging
+logging.color | boolean| makes logging output colorful. This makes skimming through the logs easier.
+logging.json | boolean | Makes logs output to be in json format. We can use tools like `jq` to manipulate output.
+logging.json-pretty-print | boolean | It's like using an in built `jq` to print our json output.
+logging.level | string | This is just a verbosity level settings. We can just use `info`
+
+for more traits options see this [Link.](https://camel.apache.org/camel-k/next/traits/logging.html).
+
+manual log setting example using  `logging trait`:
+     
+     $ kamel run ./logging.java --trait logging.enabled=true --trait logging.json=true --trait logging.level=info
+
+**Output**
+
+The output of this result would give this:
+
+```
+[2] {"timestamp":"2022-04-24T22:50:06.303Z","sequence":183,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"org.apache.camel.impl.engine.AbstractCamelContext","level":"INFO","message":"Apache Camel 3.14.1 (camel-1) started in 352ms (build:0ms init:293ms start:59ms)","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.835Z","sequence":184,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"camel-k-integration 1.8.2 on JVM (powered by Quarkus 2.7.0.Final) started in 14.348s. Listening on: http://0.0.0.0:8080","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.842Z","sequence":185,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Profile prod activated. ","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.842Z","sequence":186,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Installed features: [camel-attachments, camel-bean, camel-core, camel-direct, camel-java-joor-dsl, camel-k-core, camel-k-runtime, camel-platform-http, camel-rest, cdi, smallrye-context-propagation, vertx]","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+
+```
+- Logging would be enabled, and it's output would be in josn. But, there would be no colors for easy skimming.
+- You would need to use your own jq to pretty print and parse the json output. 
+## Using modeline 
+An example of using a `modeline` to set the `logging traits` : 
+
+     $ kamel run ./loggingModeline.java 

Review Comment:
   LoggingModeline with L



-- 
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


[GitHub] [camel-k] squakez commented on a diff in pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
squakez commented on code in PR #3231:
URL: https://github.com/apache/camel-k/pull/3231#discussion_r857345453


##########
examples/traits/logging/logging.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+//  kamel run ./logging.java --trait logging.enabled=true \
+//  --trait logging.json=true --trait logging.level=info
+import org.apache.camel.Exchange;
+
+public class RestDSL extends org.apache.camel.builder.RouteBuilder {

Review Comment:
   The class name is called RestDSL, should be Logging. Also, use Java convention and use the uppercase for class names.



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,45 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $kamel run logging.java
+
+     $kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $kubectl get pods
+
+     $kubecttl logs <pod name>
+
+You can configure the log output with the `logging traits` flag:
+      
+Property | Type | Description 
+---|---|---  
+logging.enabled | boolean| We can set to false to disable logging
+logging.color | boolean| makes logging output colorful. This makes skimming through the logs easier.
+logging.json | boolean | Makes logs output to be in json format. We can use tools like `jq` to manipulate output.
+logging.json-pretty-print | boolean | It's like using an in built `jq` to print our json output.
+logging.level | string | This is just a verbosity level settings. We can just use `info`
+
+for more traits options see this [Link.](https://camel.apache.org/camel-k/next/traits/logging.html).
+
+manual log setting example using  `logging trait`:
+     
+     $kamel run ./logging.java --trait logging.enabled=true --trait logging.json=true --trait logging.level=info
+
+The output of this result would give this:
+- Logging would be enabled, but there would be no colors for easy skimming.
+- You would need to use your own jq to pretty print and parse the json output. 
+
+**Image example**
+![json](interface/json.png)

Review Comment:
   Since it's a log trace, better copy and past the output as a code snippet



##########
examples/traits/logging/loggingModeline.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// camel-k: traits=logging.enabled=true trait=logging.json=true trait=logging.level=info
+
+import org.apache.camel.Exchange;
+
+public class RestDSL extends org.apache.camel.builder.RouteBuilder {

Review Comment:
   The class name is called RestDSL, should be LoggingMedeline. Also, use Java convention and use the uppercase for class names.



-- 
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


[GitHub] [camel-k] squakez merged pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
squakez merged PR #3231:
URL: https://github.com/apache/camel-k/pull/3231


-- 
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


[GitHub] [camel-k] squakez commented on a diff in pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
squakez commented on code in PR #3231:
URL: https://github.com/apache/camel-k/pull/3231#discussion_r857676530


##########
examples/traits/logging/Logging.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+//  kamel run ./logging.java --trait logging.enabled=true \

Review Comment:
   Logging uppercase



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $kamel run logging.java
+
+     $kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $kubectl get pods
+
+     $kubecttl logs <pod name>
+
+You can configure the log output with the `logging traits` flag:
+      
+Property | Type | Description 
+---|---|---  
+logging.enabled | boolean| We can set to false to disable logging
+logging.color | boolean| makes logging output colorful. This makes skimming through the logs easier.
+logging.json | boolean | Makes logs output to be in json format. We can use tools like `jq` to manipulate output.
+logging.json-pretty-print | boolean | It's like using an in built `jq` to print our json output.
+logging.level | string | This is just a verbosity level settings. We can just use `info`
+
+for more traits options see this [Link.](https://camel.apache.org/camel-k/next/traits/logging.html).
+
+manual log setting example using  `logging trait`:
+     
+     $kamel run ./logging.java --trait logging.enabled=true --trait logging.json=true --trait logging.level=info
+
+**Output**
+
+The output of this result would give this:
+
+```
+[2] {"timestamp":"2022-04-24T22:50:06.303Z","sequence":183,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"org.apache.camel.impl.engine.AbstractCamelContext","level":"INFO","message":"Apache Camel 3.14.1 (camel-1) started in 352ms (build:0ms init:293ms start:59ms)","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.835Z","sequence":184,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"camel-k-integration 1.8.2 on JVM (powered by Quarkus 2.7.0.Final) started in 14.348s. Listening on: http://0.0.0.0:8080","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.842Z","sequence":185,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Profile prod activated. ","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+[2] {"timestamp":"2022-04-24T22:50:06.842Z","sequence":186,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Installed features: [camel-attachments, camel-bean, camel-core, camel-direct, camel-java-joor-dsl, camel-k-core, camel-k-runtime, camel-platform-http, camel-rest, cdi, smallrye-context-propagation, vertx]","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"rest-dsl-56668cc6dc-9zz7r","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":1}
+
+```
+- Logging would be enabled, and it's output would be in josn. But, there would be no colors for easy skimming.
+- You would need to use your own jq to pretty print and parse the json output. 
+## using modeline 

Review Comment:
   Uppercase Using



##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,50 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $kamel run logging.java

Review Comment:
   either remove the `$` or add a space to separate it from `kamel`. Same for the rest.



-- 
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


[GitHub] [camel-k] Gre8t commented on pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
Gre8t commented on PR #3231:
URL: https://github.com/apache/camel-k/pull/3231#issuecomment-1107935864

   @astefanutti @squakez 


-- 
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


[GitHub] [camel-k] Gre8t commented on a diff in pull request #3231: added logging traits documentation.

Posted by GitBox <gi...@apache.org>.
Gre8t commented on code in PR #3231:
URL: https://github.com/apache/camel-k/pull/3231#discussion_r857514475


##########
examples/traits/logging/README.md:
##########
@@ -0,0 +1,45 @@
+# Logging Trait
+
+This type of trait tells us what is going on in a running integration pod. It does this by printing logs out to the standard output.
+
+Logs are enabled by default on an integration. Just run this example:
+
+     $kamel run logging.java
+
+     $kamel logs logging
+
+Or you can instead get the pod name and print its logs using kubectl: 
+
+     $kubectl get pods
+
+     $kubecttl logs <pod name>
+
+You can configure the log output with the `logging traits` flag:
+      
+Property | Type | Description 
+---|---|---  
+logging.enabled | boolean| We can set to false to disable logging
+logging.color | boolean| makes logging output colorful. This makes skimming through the logs easier.
+logging.json | boolean | Makes logs output to be in json format. We can use tools like `jq` to manipulate output.
+logging.json-pretty-print | boolean | It's like using an in built `jq` to print our json output.
+logging.level | string | This is just a verbosity level settings. We can just use `info`
+
+for more traits options see this [Link.](https://camel.apache.org/camel-k/next/traits/logging.html).
+
+manual log setting example using  `logging trait`:
+     
+     $kamel run ./logging.java --trait logging.enabled=true --trait logging.json=true --trait logging.level=info
+
+The output of this result would give this:
+- Logging would be enabled, but there would be no colors for easy skimming.
+- You would need to use your own jq to pretty print and parse the json output. 
+
+**Image example**
+![json](interface/json.png)

Review Comment:
   Ok, would do that.



-- 
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