Skip to content

Instantly share code, notes, and snippets.

View kinathru's full-sized avatar

Kinath Rupasinghe kinathru

View GitHub Profile
@kinathru
kinathru / Log4NetHelp.md
Created October 18, 2023 15:21 — forked from HarryAmmon/Log4NetHelp.md
Log4Net .NET Core Console App Quickstart

Log4Net .NET Core Console App Quickstart

Getting Log4Net working with a .NET Core console app is simple. You may have found guides for getting Log4Net working on a .NET Framework project. The setup is similar but requires a few additional steps. This quick start assumes you are using Visual Studio 2019.

Installing Log4Net

This process is the same for installing any other package using NuGet. Either the Package Manager Console or the Manage NuGet Packages GUI can be used.

Package Manger Console

Open the Package Manager Console and run the following command.

<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>JavaSpringRESTDemo</display-name>
<servlet>
<servlet-name>spring</servlet-name>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JavaSpringRESTDemo</groupId>
<artifactId>JavaSpringRESTDemo</artifactId>
<version>1.0-SNAPSHOT</version>
package com.dummys.learning;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
package com.dummys.learning;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/learning")
@CrossOrigin
public class PersonController
@kinathru
kinathru / Person.java
Created March 19, 2017 17:32
sample person class
package com.dummys.learning;
public class Person
{
private long id;
private String name;
public long getId()
{
return id;
<dependency>
<groupId>com.kinath.interwar</groupId>
<artifactId>common-lib</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
package com.kinath.interwar;
import java.lang.reflect.Method;
/**
* Created by Kinath on 3/15/2017.
*/
public class GroundServiceAdapter implements IGroundService
{
public String getMessage()
package com.kinath.interwar;
import org.springframework.context.annotation.Configuration;
/**
* Created by Kinath on 3/15/2017.
*/
@Configuration
public class GroundServiceConfig
{