We study the law of the iterated logarithm (LIL) for the maximum likelihood estimation of the parameters in the generalized linear models with independent or weakly dependent (ρ-mixing, m-dependent) responses under mild conditions. The LIL is useful to derive the asymptotic bounds for the discrepancy between the empirical log-likelihood function and the true log-likelihood. As the application of the LIL, the strong consistency of some penalized likelihood based model selection criteria can be shown. Under some regularity conditions, the model selection criterion will be helpful to select the simplest correct model almost surely when the penalty term increases with model dimension and the penalty term has an order higher than O(loglogn) but lower than O(n). Simulation studies are implemented to verify the selection consistency of BIC.