Project

General

Profile

« Previous | Next » 

Revision f7d29c7f

Added by Patrick Plitzner over 6 years ago

Add utils log method

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java
114 114
        String authorBasiString = rs.getString("AUTOR_BASI");
115 115

  
116 116
        if(CdmUtils.isBlank(taxNameString) && CdmUtils.isBlank(ep1String)){
117
            logger.error("NAMNR: "+id+" No name found!");
117
            RedListUtil.logMessage(id, "No name found!", logger);
118 118
        }
119 119

  
120 120
        Rank rank = makeRank(state, rangString);
121 121
        if(rank==null){
122
            logger.error("NAMNR: "+id+" Rank could not be resolved.");
122
            RedListUtil.logMessage(id, "Rank could not be resolved.", logger);
123 123
        }
124 124
        BotanicalName name = BotanicalName.NewInstance(rank);
125 125

  
126 126
        //ep1 should always be present
127 127
        if(CdmUtils.isBlank(ep1String)){
128
            logger.error("NAMNR: "+id+" EPI1 is empty!");
128
            RedListUtil.logMessage(id, "EPI1 is empty!", logger);
129 129
        }
130 130
        name.setGenusOrUninomial(ep1String);
131 131
        if(!CdmUtils.isBlank(ep2String)){
......
144 144
            //TODO: what happens with multiple ex authors??
145 145
            String[] kombSplit = authorKombString.split(EX);
146 146
            if(kombSplit.length!=2){
147
                logger.error("NAMNR: "+id+" Multiple ex combination authors found");
147
                RedListUtil.logMessage(id, "Multiple ex combination authors found", logger);
148 148
            }
149 149
            for (int i = 0; i < kombSplit.length; i++) {
150 150
                if(i==0){
......
159 159
            }
160 160
        }
161 161
        else if(authorKombString.trim().equals(RedListUtil.AUCT)){
162
            logger.warn("NAMNR: "+id+" AUCT information in AUTOR_KOMB column");
162
            RedListUtil.logMessage(id, "AUCT information in AUTOR_KOMB column", logger);
163 163
        }
164 164
        else if(!CdmUtils.isBlank(authorKombString)){
165 165
            TeamOrPersonBase authorKomb = (TeamOrPersonBase) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, authorKombString);
......
170 170
            String[] basiSplit = authorBasiString.split(EX);
171 171
            for (int i = 0; i < basiSplit.length; i++) {
172 172
                if(basiSplit.length!=2){
173
                    logger.error("NAMNR: "+id+" Multiple ex basionymn authors found");
173
                    RedListUtil.logMessage(id, "Multiple ex basionymn authors found", logger);
174 174
                }
175 175
                if(i==0){
176 176
                    TeamOrPersonBase authorBasi= (TeamOrPersonBase) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, basiSplit[i]);
......
220 220
            authorString = "";
221 221
        }
222 222
        if(!authorString.equals(authorshipCache)){
223
            logger.warn("NAMNR: "+id+" Authorship inconsistent! name.authorhshipCache <-> Column AUTOR: "+authorshipCache+" <-> "+authorString);
223
            RedListUtil.logMessage(id, "Authorship inconsistent! name.authorhshipCache <-> Column AUTOR: "+authorshipCache+" <-> "+authorString, logger);
224 224
        }
225 225

  
226 226
        //id
......
238 238
            taxonBase = Synonym.NewInstance(name, null);
239 239
        }
240 240
        if(taxonBase==null){
241
            logger.error("NAMNR: "+id+" Taxon for name "+name+" could not be created.");
241
            RedListUtil.logMessage(id, "Taxon for name "+name+" could not be created.", logger);
242 242
            return;
243 243
        }
244 244

  
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListUtil.java
9 9
*/
10 10
package eu.etaxonomy.cdm.io.redlist.gefaesspflanzen;
11 11

  
12
import org.apache.log4j.Logger;
13

  
12 14
/**
13 15
 * @author pplitzner
14 16
 * @date Mar 7, 2016
......
21 23
    public static final String AUTHOR_NAMESPACE = "author";
22 24
    public static final String AUCT = "auct.";
23 25

  
24
    public static logError(){
25

  
26
    public static void logMessage(long id, String message, Logger logger){
27
        logger.error("NAMNR: "+id+" "+message);
26 28
    }
27 29
}

Also available in: Unified diff