Lithology identification is of great importance in reservoir characterization. Recently, many researchers have applied machine-learning techniques to solve lithology identification problems from well-log curves, and their works indicate three main characteristics. First, most works predict lithofacies using features measured during logging, whereas very few consider adding stratigraphic sequence information that is available prior to drilling to solve this problem. Second, most studies predict lithofacies using measured properties of one depth point, whereas few take the influence of the neighboring formation into account. Third, due to a lack of publicly available interpreted well-log data, previous research has concentrated on applying different algorithms on their private data set, making it impossible to perform a comparison. We have developed a machine-learning framework to solve the Ethology classification problem from well-log curves by incorporating an additional geologic constraint. The constraint is a stratigraphic unit, and we use it as an additional feature. We evaluate three types of recurrent neural networks (RNNs), bidirectional long short-term memory, bidirectional gated recurrent unit (Bi-GRU), and GRLJ-based encoder-decoder architecture with attention, as well as two types of 1D convolutional neural networks (1D CNNs), temporal convolutional network and multiscale residual network, on a publicly available data set from the North Sea. The RNN-based networks and 1D CNN-based networks can process sequential data, enabling the model to have access to information from neighboring formations when pertiming lithofacies prediction at a particular depth. Our experiments indicate that geologic constraint improves the performance of the models significantly, and that the overall performance of RNN-based networks is better and more consistent.