You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2018/10/12 17:08:30 UTC

[camel-k] 02/03: chore(kamel) : add a flag to easilly configure logging

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2f942e50531a58dec3dd4fa7e673e1067a38324f
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Oct 12 16:35:58 2018 +0200

    chore(kamel) : add a flag to easilly configure logging
---
 pkg/client/cmd/run.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pkg/client/cmd/run.go b/pkg/client/cmd/run.go
index a22b58f..39ef9a8 100644
--- a/pkg/client/cmd/run.go
+++ b/pkg/client/cmd/run.go
@@ -76,6 +76,7 @@ func newCmdRun(rootCmdOptions *RootCmdOptions) *cobra.Command {
 	cmd.Flags().BoolVar(&options.Dev, "dev", false, "Enable Dev mode (equivalent to \"-w --logs --sync\")")
 	cmd.Flags().BoolVar(&options.DependenciesAutoDiscovery, "auto-discovery", true, "Automatically discover Camel modules by analyzing user code")
 	cmd.Flags().StringSliceVarP(&options.Traits, "trait", "t", nil, "Configure a trait. E.g. \"-t service.enabled=false\"")
+	cmd.Flags().StringSliceVar(&options.LoggingLevels, "logging-level", nil, "Configure the logging level. E.g. \"--logging-level org.apache.camel=DEBUG\"")
 
 	// completion support
 	configureKnownCompletions(&cmd)
@@ -99,6 +100,7 @@ type runCmdOptions struct {
 	Dev                       bool
 	DependenciesAutoDiscovery bool
 	Traits                    []string
+	LoggingLevels             []string
 }
 
 func (o *runCmdOptions) validateArgs(cmd *cobra.Command, args []string) error {
@@ -309,6 +311,12 @@ func (o *runCmdOptions) updateIntegrationCode(filename string) (*v1alpha1.Integr
 			Value: item,
 		})
 	}
+	for _, item := range o.LoggingLevels {
+		integration.Spec.Configuration = append(integration.Spec.Configuration, v1alpha1.ConfigurationSpec{
+			Type:  "property",
+			Value: "logging.level." + item,
+		})
+	}
 	for _, item := range o.ConfigMaps {
 		integration.Spec.Configuration = append(integration.Spec.Configuration, v1alpha1.ConfigurationSpec{
 			Type:  "configmap",