Repository: jhipster/generator-jhipster
Pull request #9620 (2019-04-25 16:33:17)

Use Spring Boot loggers actuator endpoint
-   Please make sure the below checklist is followed for Pull Requests.

-   [ ] [Travis tests](https://travis-ci.org/jhipster/generator-jhipster/pull_requests) are green
-   [x] Tests are added where necessary
-   [x] Documentation is added/updated where necessary
-   [x] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed

<!--
Please also reference the issue number in a commit message to [automatically close the related Github issue](https://help.github.com/articles/closing-issues-via-commit-messages/)

Note: It is also possible to add `[skip ci]` to your commit message to skip Travis tests
-->

An actuator has been added to Spring Boot 2 for the loggers so we can use it and remove our own controller as per Policy 1.


Patch:
diff --git a/generators/cleanup.js b/generators/cleanup.js
index ff87322268..e67e3c52a9 100644
--- a/generators/cleanup.js
+++ b/generators/cleanup.js
@@ -180,6 +180,9 @@ function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, tes
         generator.removeFile(`${javaDir}web/rest/util/PaginationUtil.java`);
         generator.removeFile(`${javaDir}web/rest/util/HeaderUtil.java`);
         generator.removeFile(`${testDir}web/rest/util/PaginationUtilUnitTest.java`);
+        generator.removeFile(`${javaDir}web/rest/vm/LoggerVM.java`);
+        generator.removeFile(`${javaDir}web/rest/LogsResource.java`);
+        generator.removeFile(`${testDir}web/rest/LogsResourceIT.java`);
         generator.removeFile(`${javaDir}config/OAuth2Configuration.java`);
         generator.removeFile(`${javaDir}security/OAuth2AuthenticationSuccessHandler.java`);
 
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.component.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.component.ts.ejs
index a83dd3c40a..b7efada6b2 100644
--- a/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.component.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.component.ts.ejs
@@ -41,13 +41,17 @@ export class LogsComponent implements OnInit {
     }
 
     ngOnInit() {
-        this.logsService.findAll().subscribe((response) => this.loggers = response.body);
+        this.logsService.findAll().subscribe(response => this.extractLoggers(response));
     }
 
     changeLevel(name: string, level: string) {
-        const log = new Log(name, level);
-        this.logsService.changeLevel(log).subscribe(() => {
-            this.logsService.findAll().subscribe((response) => this.loggers = response.body);
+        this.logsService.changeLevel(name, level).subscribe(() => {
+            this.logsService.findAll().subscribe(response => this.extractLoggers(response));
         });
     }
+
+    private extractLoggers(response) {
+        this.loggers = Object.entries(response.body.loggers)
+            .map(e => new Log(e[0], e[1]['effectiveLevel']));
+    }
 }
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.service.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.service.ts.ejs
index 4faf68b3d7..da624b8e2c 100644
--- a/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.service.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/admin/logs/logs.service.ts.ejs
@@ -21,17 +21,16 @@ import { HttpClient, HttpResponse } from '@angular/common/http';
 import { Observable } from 'rxjs';
 
 import { SERVER_API_URL } from 'app/app.constants';
-import { Log } from './log.model';
 
 @Injectable({providedIn: 'root'})
 export class LogsService {
     constructor(private http: HttpClient) { }
 
-    changeLevel(log: Log): Observable<HttpResponse<any>> {
-        return this.http.put(SERVER_API_URL + 'management/logs', log, {observe: 'response'});
+    changeLevel(name: string, configuredLevel: string): Observable<HttpResponse<any>> {
+        return this.http.post(SERVER_API_URL + 'management/loggers/' + name, {configuredLevel}, { observe: 'response' });
     }
 
-    findAll(): Observable<HttpResponse<Log[]>> {
-        return this.http.get<Log[]>(SERVER_API_URL + 'management/logs', {observe: 'response'});
+    findAll(): Observable<HttpResponse<any>> {
+        return this.http.get<any>(SERVER_API_URL + 'management/loggers', { observe: 'response' });
     }
 }
diff --git a/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs b/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs
index ed686fd8cd..b51c9d88ca 100644
--- a/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs
+++ b/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs
@@ -127,7 +127,7 @@ export default (state: AdministrationState = initialState, action): Administrati
         ...state,
         loading: false,
         logs: {
-          loggers: action.payload.data
+          loggers: action.payload.data.loggers
         }
       };
     case SUCCESS(ACTION_TYPES.FETCH_CONFIGURATIONS):
@@ -202,18 +202,15 @@ export const systemThreadDump = () => ({
 
 export const getLoggers = () => ({
   type: ACTION_TYPES.FETCH_LOGS,
-  payload: axios.get('management/logs')
+  payload: axios.get('management/loggers')
 });
 
-export const changeLogLevel = (name, level) => {
-  const body = {
-    level,
-    name
-  };
+export const changeLogLevel = (name, configuredLevel) => {
+  const body = { configuredLevel };
   return async dispatch => {
     await dispatch({
       type: ACTION_TYPES.FETCH_LOGS_CHANGE_LEVEL,
-      payload: axios.put('management/logs', body)
+      payload: axios.post('management/loggers/' + name, body)
     });
     dispatch(getLoggers());
   };
diff --git a/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs b/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs
index b11e8198ca..d214bba8c5 100644
--- a/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs
+++ b/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs
@@ -62,7 +62,7 @@ export class LogsPage extends React.Component<ILogsPageProps, ILogsPageState> {
   render() {
     const { logs, isFetching } = this.props;
     const { filter } = this.state;
-    const loggers = logs ? logs.loggers : [];
+    const loggers = logs ? Object.entries(logs.loggers).map(e => ({ name: e[0], level: e[1].effectiveLevel })) : [];
     return (
         <div>
           <h2 id="logs-page-heading"><Translate contentKey="logs.title">Logs</Translate></h2>
diff --git a/generators/server/files.js b/generators/server/files.js
index d6096fdd7f..abd0ee796b 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -1087,17 +1087,9 @@ const serverFiles = {
                     file: 'package/web/rest/vm/package-info.java',
                     renameTo: generator => `${generator.javaDir}web/rest/vm/package-info.java`
                 },
-                {
-                    file: 'package/web/rest/vm/LoggerVM.java',
-                    renameTo: generator => `${generator.javaDir}web/rest/vm/LoggerVM.java`
-                },
                 {
                     file: 'package/web/rest/package-info.java',
                     renameTo: generator => `${generator.javaDir}web/rest/package-info.java`
-                },
-                {
-                    file: 'package/web/rest/LogsResource.java',
-                    renameTo: generator => `${generator.javaDir}web/rest/LogsResource.java`
                 }
             ]
         },
@@ -1166,10 +1158,6 @@ const serverFiles = {
             path: SERVER_TEST_SRC_DIR,
             templates: [
                 { file: 'package/web/rest/TestUtil.java', renameTo: generator => `${generator.testDir}web/rest/TestUtil.java` },
-                {
-                    file: 'package/web/rest/LogsResourceIT.java',
-                    renameTo: generator => `${generator.testDir}web/rest/LogsResourceIT.java`
-                },
                 {
                     file: 'package/web/rest/errors/ExceptionTranslatorIT.java',
                     renameTo: generator => `${generator.testDir}web/rest/errors/ExceptionTranslatorIT.java`
diff --git a/generators/server/templates/src/main/java/package/web/rest/LogsResource.java.ejs b/generators/server/templates/src/main/java/package/web/rest/LogsResource.java.ejs
deleted file mode 100644
index f3367baacf..0000000000
--- a/generators/server/templates/src/main/java/package/web/rest/LogsResource.java.ejs
+++ /dev/null
@@ -1,63 +0,0 @@
-<%#
- Copyright 2013-2019 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- 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
-
-      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.
--%>
-package <%=packageName%>.web.rest;
-
-import <%=packageName%>.web.rest.vm.LoggerVM;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
-<%_ if (reactive) { _%>
-import reactor.core.publisher.Flux;
-<%_ } else { _%>
-
-import java.util.List;
-import java.util.stream.Collectors;
-<%_ } _%>
-
-/**
- * Controller for view and managing Log Level at runtime.
- */
-@RestController
-@RequestMapping("/management")
-public class LogsResource {
-
-    @GetMapping("/logs")
-    public <% if (reactive) { %>Flux<% } else { %>List<% } %><LoggerVM> getList() {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        <%_ if (reactive) { _%>
-        return Flux.fromIterable(context.getLoggerList())
-            .map(LoggerVM::new);
-        <%_ } else { _%>
-        return context.getLoggerList()
-            .stream()
-            .map(LoggerVM::new)
-            .collect(Collectors.toList());
-        <%_ } _%>
-    }
-
-    @PutMapping("/logs")
-    @ResponseStatus(HttpStatus.NO_CONTENT)
-    public void changeLevel(@RequestBody LoggerVM jsonLogger) {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
-    }
-}
diff --git a/generators/server/templates/src/main/java/package/web/rest/vm/LoggerVM.java.ejs b/generators/server/templates/src/main/java/package/web/rest/vm/LoggerVM.java.ejs
deleted file mode 100644
index e3f6bcfc6f..0000000000
--- a/generators/server/templates/src/main/java/package/web/rest/vm/LoggerVM.java.ejs
+++ /dev/null
@@ -1,64 +0,0 @@
-<%#
- Copyright 2013-2019 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- 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
-
-      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.
--%>
-package <%=packageName%>.web.rest.vm;
-
-import ch.qos.logback.classic.Logger;
-
-/**
- * View Model object for storing a Logback logger.
- */
-public class LoggerVM {
-
-    private String name;
-
-    private String level;
-
-    public LoggerVM(Logger logger) {
-        this.name = logger.getName();
-        this.level = logger.getEffectiveLevel().toString();
-    }
-
-    public LoggerVM() {
-        // Empty public constructor used by Jackson.
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getLevel() {
-        return level;
-    }
-
-    public void setLevel(String level) {
-        this.level = level;
-    }
-
-    @Override
-    public String toString() {
-        return "LoggerVM{" +
-            "name='" + name + '\'' +
-            ", level='" + level + '\'' +
-            '}';
-    }
-}
diff --git a/generators/server/templates/src/main/resources/config/application.yml.ejs b/generators/server/templates/src/main/resources/config/application.yml.ejs
index e34878937a..abd4f69455 100644
--- a/generators/server/templates/src/main/resources/config/application.yml.ejs
+++ b/generators/server/templates/src/main/resources/config/application.yml.ejs
@@ -112,7 +112,7 @@ management:
         web:
             base-path: /management
             exposure:
-                include: ["configprops", "env", "health", "info", "threaddump", "logfile", "jhimetrics", "prometheus" ]
+                include: ["configprops", "env", "health", "info", "jhimetrics", "logfile", "loggers", "prometheus", "threaddump"]
     endpoint:
         health:
             show-details: when-authorized


Test patch:
diff --git a/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts.ejs b/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts.ejs
index f9985c561d..53e8616f99 100644
--- a/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts.ejs
+++ b/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts.ejs
@@ -61,7 +61,13 @@ describe('Component Tests', () => {
                 spyOn(service, 'findAll').and.returnValue(
                     of(
                         new HttpResponse({
-                            body: [log],
+                            body: {
+                                loggers: {
+                                    main: {
+                                        effectiveLevel: 'WARN'
+                                    }
+                                }
+                            },
                             headers
                         })
                     )
@@ -80,7 +86,17 @@ describe('Component Tests', () => {
                 // GIVEN
                 const log = new Log('main', 'ERROR');
                 spyOn(service, 'changeLevel').and.returnValue(of(new HttpResponse()));
-                spyOn(service, 'findAll').and.returnValue(of(new HttpResponse({ body: [log] })));
+                spyOn(service, 'findAll').and.returnValue(of(
+                    new HttpResponse({
+                        body: {
+                            loggers: {
+                                main: {
+                                    effectiveLevel: 'ERROR'
+                                }
+                            }
+                        }
+                    })
+                ));
 
                 // WHEN
                 comp.changeLevel('main', 'ERROR');
diff --git a/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts.ejs b/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts.ejs
index 1771f600c1..63db76118c 100644
--- a/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts.ejs
+++ b/generators/client/templates/angular/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts.ejs
@@ -45,35 +45,20 @@ describe('Service Tests', () => {
 
         describe('Service methods', () => {
             it('should call correct URL', () => {
-                service.findAll().subscribe(() => {});
+                service.findAll().subscribe();
 
                 const req = httpMock.expectOne({ method: 'GET' });
-                const resourceUrl = SERVER_API_URL + 'management/logs';
+                const resourceUrl = SERVER_API_URL + 'management/loggers';
                 expect(req.request.url).toEqual(resourceUrl);
             });
 
-            it('should return Logs', () => {
-                const log = new Log('main', 'ERROR');
-
-                service.findAll().subscribe(received => {
-                    expectedResult = received;
-                });
-
-                const req = httpMock.expectOne({ method: 'GET' });
-                req.flush([log]);
-                expect(expectedResult.body[0]).toEqual(log);
-            });
-
             it('should change log level', () => {
-                const log = new Log('main', 'ERROR');
-
-                service.changeLevel(log).subscribe(received => {
-                    expectedResult = received;
-                });
+                service.changeLevel('main', 'ERROR').subscribe();
 
-                const req = httpMock.expectOne({ method: 'PUT' });
-                req.flush([log]);
-                expect(expectedResult.body[0]).toEqual(log);
+                const req = httpMock.expectOne({ method: 'POST' });
+                const resourceUrl = SERVER_API_URL + 'management/loggers/main';
+                expect(req.request.url).toEqual(resourceUrl);
+                expect(req.request.body).toEqual({configuredLevel: 'ERROR'});
             });
         });
     });
diff --git a/generators/client/templates/react/src/test/javascript/spec/app/modules/administration/administration.reducer.spec.ts.ejs b/generators/client/templates/react/src/test/javascript/spec/app/modules/administration/administration.reducer.spec.ts.ejs
index 353b7c55a0..72a4cd2fdf 100644
--- a/generators/client/templates/react/src/test/javascript/spec/app/modules/administration/administration.reducer.spec.ts.ejs
+++ b/generators/client/templates/react/src/test/javascript/spec/app/modules/administration/administration.reducer.spec.ts.ejs
@@ -142,12 +142,19 @@ describe('Administration reducer tests', () => {
     });
     <%_ } _%>
     it('should update state according to a successful fetch logs request', () => {
-      const payload = { data: [{ name: 'ROOT', level: 'DEBUG' }] };
+      const payload = { data: {
+          loggers: {
+            main: {
+              effectiveLevel: 'WARN'
+            }
+          }
+        }
+      };
       const toTest = administration(undefined, { type: SUCCESS(ACTION_TYPES.FETCH_LOGS), payload });
 
       expect(toTest).toMatchObject({
         loading: false,
-        logs: { loggers: payload.data }
+        logs: payload.data
       });
     });
 
@@ -261,7 +268,7 @@ describe('Administration reducer tests', () => {
       const mockStore = configureStore([thunk, promiseMiddleware]);
       store = mockStore({});
       axios.get = sinon.stub().returns(Promise.resolve(resolvedObject));
-      axios.put = sinon.stub().returns(Promise.resolve(resolvedObject));
+      axios.post = sinon.stub().returns(Promise.resolve(resolvedObject));
     });
     <%_ if (applicationType === 'gateway' && serviceDiscoveryType) { _%>
     it('dispatches FETCH_GATEWAY_ROUTE_PENDING and FETCH_GATEWAY_ROUTE_FULFILLED actions', async () => {
diff --git a/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs b/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
index 6e99124058..b003041635 100644
--- a/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
+++ b/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
@@ -32,6 +32,8 @@ import org.springframework.http.MediaType;
 import org.springframework.test.web.servlet.MockMvc;
 import org.springframework.test.web.servlet.ResultActions;
 import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -53,17 +55,17 @@ public class ClientForwardControllerIT <% if (databaseType === 'cassandra') { %>
     @BeforeEach
     public void setup() {
         ClientForwardController clientForwardController = new ClientForwardController();
-        LogsResource logsResource = new LogsResource();
         this.restMockMvc = MockMvcBuilders
-            .standaloneSetup(clientForwardController, logsResource)
+            .standaloneSetup(clientForwardController, new TestController())
             .build();
     }
 
     @Test
     public void getBackendEndpoint() throws Exception {
-        restMockMvc.perform(get("/management/logs"))
+        restMockMvc.perform(get("/test"))
             .andExpect(status().isOk())
-            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
+            .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN_VALUE))
+            .andExpect(content().string("test"));
     }
 
     @Test
@@ -80,4 +82,13 @@ public class ClientForwardControllerIT <% if (databaseType === 'cassandra') { %>
             .andExpect(status().isOk())
             .andExpect(forwardedUrl("/"));
     }
+
+    @RestController
+    public static class TestController {
+
+        @RequestMapping(value = "/test")
+        public String test() {
+            return "test";
+        }
+    }
 }
diff --git a/generators/server/templates/src/test/java/package/web/rest/LogsResourceIT.java.ejs b/generators/server/templates/src/test/java/package/web/rest/LogsResourceIT.java.ejs
deleted file mode 100644
index 618738a3fb..0000000000
--- a/generators/server/templates/src/test/java/package/web/rest/LogsResourceIT.java.ejs
+++ /dev/null
@@ -1,124 +0,0 @@
-<%#
- Copyright 2013-2019 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- 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
-
-      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.
--%>
-package <%= packageName %>.web.rest;
-
-<%_ if (databaseType === 'cassandra') { _%>
-import <%= packageName %>.AbstractCassandraTest;
-<%_ } _%>
-import <%= packageName %>.<%= mainClass %>;
-<%_ if (authenticationType === 'oauth2') { _%>
-import <%=packageName%>.config.TestSecurityConfiguration;
-<%_ } _%>
-<%_ if (authenticationType === 'uaa') { _%>
-import <%= packageName %>.config.SecurityBeanOverrideConfiguration;
-<%_ } _%>
-import <%= packageName %>.web.rest.vm.LoggerVM;
-import ch.qos.logback.classic.AsyncAppender;
-import ch.qos.logback.classic.LoggerContext;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.MediaType;
-<%_ if (reactive) { _%>
-import org.springframework.test.web.reactive.server.WebTestClient;
-<%_ } else { _%>
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-<%_ } _%>
-
-import static org.assertj.core.api.Assertions.assertThat;
-<%_ if (!reactive) { _%>
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-<%_ } _%>
-
-/**
- * Integration tests for the {@link LogsResource} REST controller.
- */
-<%_ if (authenticationType === 'uaa' && applicationType !== 'uaa') { _%>
-@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, <%= mainClass %>.class})
-<%_ } else if (authenticationType === 'oauth2') { _%>
-@SpringBootTest(classes = {<%= mainClass %>.class, TestSecurityConfiguration.class})
-<%_ } else { _%>
-@SpringBootTest(classes = <%= mainClass %>.class)
-<%_ } _%>
-public class LogsResourceIT <% if (databaseType === 'cassandra') { %>extends AbstractCassandraTest <% } %>{
-
-    <%_ if (reactive) { _%>
-    private WebTestClient webTestClient;
-    <%_ } else { _%>
-    private MockMvc restLogsMockMvc;
-    <%_ } _%>
-
-    @BeforeEach
-    public void setup() {
-        LogsResource logsResource = new LogsResource();
-        <%_ if (reactive) { _%>
-        this.webTestClient = WebTestClient
-            .bindToController(logsResource)
-        <%_ } else { _%>
-        this.restLogsMockMvc = MockMvcBuilders
-            .standaloneSetup(logsResource)
-        <%_ } _%>
-            .build();
-    }
-
-    @Test
-    public void getAllLogs() throws Exception {
-        <%_ if (reactive) { _%>
-        webTestClient.get().uri("/management/logs")
-            .exchange()
-            .expectStatus().isOk()
-            .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
-        <%_ } else { _%>
-        restLogsMockMvc.perform(get("/management/logs"))
-            .andExpect(status().isOk())
-            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
-        <%_ } _%>
-    }
-
-    @Test
-    public void changeLogs() throws Exception {
-        LoggerVM logger = new LoggerVM();
-        logger.setLevel("INFO");
-        logger.setName("ROOT");
-
-        <%_ if (reactive) { _%>
-        webTestClient.put().uri("/management/logs")
-            .contentType(TestUtil.APPLICATION_JSON_UTF8)
-            .syncBody(TestUtil.convertObjectToJsonBytes(logger))
-            .exchange()
-            .expectStatus().isNoContent();
-        <%_ } else { _%>
-        restLogsMockMvc.perform(put("/management/logs")
-            .contentType(TestUtil.APPLICATION_JSON_UTF8)
-            .content(TestUtil.convertObjectToJsonBytes(logger)))
-            .andExpect(status().isNoContent());
-        <%_ } _%>
-    }
-
-    @Test
-    public void testLogstashAppender() {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class);
-    }
-}
diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js
index 2d522ba9f2..f6d222f270 100644
--- a/test/utils/expected-files.js
+++ b/test/utils/expected-files.js
@@ -195,11 +195,8 @@ const expectedFiles = {
         `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/errors/InvalidPasswordException.java`,
         `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/errors/LoginAlreadyUsedException.java`,
         `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/vm/package-info.java`,
-        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/vm/LoggerVM.java`,
         `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/package-info.java`,
-        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/LogsResource.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/security/SecurityUtilsUnitTest.java`,
-        `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/LogsResourceIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/TestUtil.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/errors/ExceptionTranslatorIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/errors/ExceptionTranslatorTestController.java`,