Skip to content

Commit

Permalink
add Azure logging guide (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
burtbeckwith authored Sep 4, 2024
1 parent 3cd6bea commit 4a59a12
Show file tree
Hide file tree
Showing 11 changed files with 503 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed 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
*
* https://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.
*/
package example.micronaut

import groovy.util.logging.Slf4j
import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Post

@Slf4j('LOG')
@Controller
class LogController {

@Post('/log')
void log(@Body String message) {
LOG.info(message)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed 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
*
* https://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.
*/
package example.micronaut;

import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Controller
class LogController {

private static final Logger LOG = LoggerFactory.getLogger(LogController.class);

@Post("/log")
void log(@Body String message) {
LOG.info(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed 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
*
* https://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.
*/
package example.micronaut;

import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Post
import org.slf4j.Logger
import org.slf4j.LoggerFactory

@Controller
class LogController {

@Post("/log")
fun log(@Body message: String) {
LOG.info(message)
}

companion object {
private val LOG: Logger = LoggerFactory.getLogger(LogController::class.java)
}
}
14 changes: 14 additions & 0 deletions guides/micronaut-azure-logging/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Publish Micronaut application logs to Microsoft Azure Monitor Logs",
"intro": "Learn how to send your Micronaut application Logback logs to Microsoft Azure Monitor Logs.",
"authors": ["Burt Beckwith"],
"tags": ["azure", "cloud"],
"categories": ["Microsoft Azure"],
"publicationDate": "2024-08-22",
"apps": [
{
"name": "default",
"features": []
}
]
}
Loading

0 comments on commit 4a59a12

Please sign in to comment.