2017년 2월 28일 화요일

[Tomcat] catalina.out 날짜별 생성

Tomcat catalina.out daily logrotate



1. logrotate 설정 디렉토리로 이동
$ cd /etc/logrotate.d/

2. 설정 파일 생성
$ nano tomcat
/var/local/tomcat/logs/catalina.out {
     copytruncate
     daily
     rotate 30
     missingok
     notifempty
     dateext
}

3. (선택) 현재 파일 강제 갱신
$ logrotate -f /etc/logrotate.d/tomcat



설정 파일 참고 :
http://linuxcommand.org/man_pages/logrotate8.html


2017년 2월 16일 목요일

[Spring Security] AJAX 요청시 403 Invalid CSRF Token 발생하는 경우


--------------------
메타 태그에 값 추가
--------------------
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>



--------------------
스크립트
--------------------
var token = $("meta[name='_csrf']").attr("content");
var header = $("meta[name='_csrf_header']").attr("content");

$.ajax({
        ...
        beforeSend: function(xhr) {
            xhr.setRequestHeader(header, token);
        },
        ...




참고:
http://docs.spring.io/spring-security/site/docs/3.2.0.CI-SNAPSHOT/reference/html/csrf.html#csrf-include-csrf-token-ajax

[Mybatis] 한글 입력시 물음표(?)로 입력될 경우

Mybatis 한글깨짐


jdbc.url=jdbc:mysql://localhost:3306/디비명?useUnicode=true&characterEncoding=utf8